<div class="gmail_quote">Hi,<br><br>I'm completely new to nginx - I've just started using it a day ago, but I've managed to set up a reverse proxy szenario with nginx as a front end and 3 apache servers (2.0.63) as the backend servers.<br>
<br><b>The strange thing that is happening is: sometimes the pages are not
displayed to the user, but it just freezes, i.e. the page is not
loading, BUT when I kill the nginx process (the only connection to the
outer world) all files from the current request (that was hanging) are
served immediately. It seems like the buffer is not written to the open
connection and killing nginx causes nginx to release the connection and
thus the data on it?!?!<br>
<br>
Can anyone help solving the Gordic know as per why the data is not
send, but the request hangs? Is nginx waiting for something before
sending the request out? If so why and more importantly: can I turn
this behavior off? </b><br><br>The apache servers are listening on the following addresses:<br><ul><li><a href="http://192.168.0.1:80" target="_blank">192.168.0.1:80</a> -> web1<br></li><li><a href="http://192.168.0.2:80" target="_blank">192.168.0.2:80</a> -> web2<br>
</li><li><a href="http://192.168.0.3:80" target="_blank">192.168.0.3:80</a> -> web3<br></li></ul>My public IP address is 69.64.147.249 and nginx is listening on web1 on port 80. I have to match 4 different domains to consider:<br>
<ul>
<li><a href="http://example.com" target="_blank">example.com</a></li><li><a href="http://app.example.com" target="_blank">app.example.com</a></li><li>*.<a href="http://app.example.com" target="_blank">app.example.com</a> (should be distributed between web1, web2, web3)</li>
<li><a href="http://static.example.com" target="_blank">static.example.com</a> (for static file serving)<br></li></ul>I have defined 2 upstreams<br><ul><li><a href="http://proxy1.example.com" target="_blank">proxy1.example.com</a>: for dealing with requests to <a href="http://example.com" target="_blank">example.com</a> and <a href="http://app.example.com" target="_blank">app.example.com</a> on only web1</li>
<li><a href="http://proxy2.example.com" target="_blank">proxy2.example.com</a>: for dealing with requests to *.<a href="http://example.com" target="_blank">example.com</a> on web1, web2, web3<br></li></ul><b></b><br>The described problem occurs in versions nginx-0.7.38 and nginx-0.6.35.<br>
<br>Thanks so much for your help!<br><br>Bests,<br>Peter<br><br><br>This is my configuration:<br><br>##########<br><br>user nginx nginx;<br><br>worker_processes 1;<br><br>events {<br> worker_connections 1024;<br>}<br>
<br>http {<br> include mime.types;<br> default_type text/plain;<br><br> sendfile on;<br><br> keepalive_timeout 65;<br> <br> server_name_in_redirect off;<br><br> gzip on;<br>
gzip_min_length 1100;<br> gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/png;<br><br><br> upstream <a href="http://proxy1.example.com" target="_blank">proxy1.example.com</a> {<br>
server <a href="http://192.168.0.1:80" target="_blank">192.168.0.1:80</a>;<br> }<br><br> upstream <a href="http://proxy2.example.com" target="_blank">proxy2.example.com</a> {<br> server <a href="http://192.168.0.1:80" target="_blank">192.168.0.1:80</a>;<br>
server <a href="http://192.168.0.2:80" target="_blank">192.168.0.2:80</a>;<br> server <a href="http://192.168.0.3:80" target="_blank">192.168.0.3:80</a>;<br> }<br><br> server {<br> listen 69.64.147.249;<br>
server_name <a href="http://www.example.com" target="_blank">www.example.com</a>;<br>
rewrite ^(.*) <a href="http://example.com" target="_blank">http://example.com</a>$1 permanent;<br> }<br> <br> server {<br> listen 69.64.147.249;<br> server_name <a href="http://example.com" target="_blank">example.com</a> <a href="http://app.example.com" target="_blank">app.example.com</a>;;<br>
location / {<br> access_log off;<br> proxy_pass <a href="http://proxy1.example.com" target="_blank">http://proxy1.example.com</a>;<br><br> proxy_set_header Host $host;<br>
proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> client_max_body_size 10m;<br> client_body_buffer_size 128k;<br>
proxy_connect_timeout 90;<br> proxy_send_timeout 90;<br> proxy_read_timeout 90;<br> proxy_buffer_size 4k;<br> proxy_buffers 4 32k;<br>
proxy_busy_buffers_size 64k;<br> proxy_temp_file_write_size 64k;<br> }<br> }<br><br><br> server {<br> listen 69.64.147.249;<br> server_name *.<a href="http://app.example.com" target="_blank">app.example.com</a>;<br>
location / {<br> access_log off;<br> proxy_pass <a href="http://proxy2.example.com" target="_blank">http://proxy2.example.com</a>;<br><br> gzip off;<br> proxy_set_header Host $host;<br>
proxy_set_header X-Real-IP $remote_addr;<br> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br> client_max_body_size 10m;<br> client_body_buffer_size 128k;<br>
proxy_connect_timeout 90;<br> proxy_send_timeout 90;<br> proxy_read_timeout 90;<br> <br> proxy_buffering on;<br> proxy_buffer_size 4k;<br>
proxy_buffers 4 32k;<br> proxy_busy_buffers_size 64k;<br> proxy_temp_file_write_size 64k;<br> }<br> }<br><br> server {<br> listen 69.64.147.249;<br>
server_name <a href="http://static.example.com" target="_blank">static.example.com</a>;<br> access_log logs/access.www.example.com.log;<br><br> # deny access to .htaccess files, if Apache's document root<br>
# concurs with nginx's one<br> location ~ /\.ht {<br> deny all;<br> }<br> }<br>}<br><br>##########<br>
</div><br>