nginx isn't proxying

Code:
user                nginx nginx; 
worker_processes    2; 
 
error_log           /var/log/nginx/error.log warn; 
pid                 /var/run/nginx.pid; 
 
events { 
    worker_connections  1024; 
    use epoll; 
} 
 
http { 
    # allow long server names 
    server_names_hash_bucket_size 64; 
    
    include             /etc/nginx/mime.types; 
    default_type        application/octet-stream; 
 
    log_format main '$remote_addr - $remote_user [$time_local] ' 
                    '"$request" $status $body_bytes_sent "$http_referer" ' 
                    '"$http_user_agent" "$http_x_forwarded_for"'; 
 
    access_log          /var/log/nginx/access.log; 
    
    # spool uploads to disk instead of clobbering downstream servers 
    client_body_temp_path /var/spool/nginx-client-body 1 2; 
    client_max_body_size 32m; 
    client_body_buffer_size    128k; 
    
    server_tokens       off; 
 
    sendfile            on; 
    tcp_nopush          on; 
    tcp_nodelay         off; 
 
    keepalive_timeout   5; 
    
    ## Compression 
    gzip on; 
    gzip_http_version 1.0; 
    gzip_comp_level 2; 
    gzip_proxied any; 
    gzip_min_length  1100; 
    gzip_buffers 16 8k; 
    gzip_types text/plain text/html text/css application/x-javascript \ 
        text/xml application/xml application/xml+rss text/javascript \ 
        image/gif image/jpeg image/png; 
    # Some version of IE 6 don't handle compression well on some mime-types, 
    # so just disable for them 
    gzip_disable "MSIE [1-6].(?!.*SV1)"; 
    # Set a vary header so downstream proxies don't send cached gzipped 
    # content to IE6 
    gzip_vary on; 
    
    # proxy settings 
    proxy_redirect     off; 
 
    proxy_set_header   Host             $host; 
    proxy_set_header   X-Real-IP        $remote_addr; 
    proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for; 
    proxy_max_temp_file_size 0; 
 
    proxy_connect_timeout      90; 
    proxy_send_timeout         90; 
    proxy_read_timeout         90; 
 
    proxy_buffer_size          4k; 
    proxy_buffers              4 32k; 
    proxy_busy_buffers_size    64k; 
    proxy_temp_file_write_size 64k; 
 
    include             /usr/local/nginx/sites-enabled/*; 
 
}
Code:
server {
	listen 80;
	server_name myvirtualhost.com www.myvirutalhost.com;
 
	location / {
		proxy_pass http://192.168.0.56:8080;
		proxy_redirect default;
 
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	}
}
The first of the above is the nginx.conf and the second is myvirtualhost.conf in the sites-enabled directory.

These files are from a working setup that I had on OpenSolaris, however I cannot get them to redirect now. When I type in the domain name (www.myvirtualhost.com:) it is being redirected from my firewall to 192.168.0.55:80 (nginx), but then I expect it to pass that to Apache running on 192.168.0.56 and listening on 8080.

However, all I get is a web page that says "Welcome to nginx!" In httpd.conf I have the Listen directive as 192.168.0.56:8080 and have the ServerName directive as 192.168.0.56 and also tried myvirtualhost.com but nothing seems to work.

Like I mentioned, this worked on OpenSolaris and the files are saved from that installation before I dumped it altogether.

If anyone can spot a problem or suggestion, I'd be appreciative because right now I can't see the problem and have spent about 3 hours on it already.
 
Hello , if I understand correct you want to import the config from nginx installed on Open Solaris to nginx installed on FreeBSD ?
This config cannot be applied on FreeBSD as main reason FreeBSD uses kqueue(2) not epoll , also paths have to be edited ( mime.types is in /usr/local/etc/nginx ) , also have to add user nginx on the system .

If you want to use nginx as reverse proxy proxy_redirect have to be off , i.e

Code:
proxy_redirect off;

otherwise if you use default try to add port after host , i.e
Code:
proxy_set_header Host $host:$proxy_port;

What type of proxying you wish to implement ?
 
Back
Top