Hi, I have a little problem that's driving me crazy since 4 days. I'm trying to create a server with NginX (0.8.35) serving static content (PDF files mainly) as frontend and Apache2 as backend processing the PHP files, actually I'm working only with basic PHP (phpinfo()) files for testing purposes (this isn't my production machine, only a pre-production-kind-machine. Apache is running in <a href="http://127.0.0.1:8080">127.0.0.1:8080</a><div>
<br></div><div>When I'm trying to proxy the PHP to Apache is issuing a 301 Redirection (i tested it with cURL from another host, and giving a network error in IE8 and Chrome.</div><div>Here I include the config files loaded in Nginx:</div>
<div><br></div><div>Nginx.conf</div><div><div>user www-data;</div><div>worker_processes 1;</div><div><br></div><div>error_log /var/log/nginx/error.log;</div><div>pid /var/run/nginx.pid;</div><div><br></div><div>events {</div>
<div> worker_connections 1024;</div><div> # multi_accept on;</div><div>}</div><div><br></div><div>http {</div><div> include /etc/nginx/mime.types;</div><div><br></div><div> access_log<span class="Apple-tab-span" style="white-space:pre"> </span>/var/log/nginx/access.log;</div>
<div><br></div><div> sendfile on;</div><div> #tcp_nopush on;</div><div><br></div><div> #keepalive_timeout 0;</div><div> keepalive_timeout 65;</div><div> tcp_nodelay on;</div><div><br></div>
<div> gzip on;</div><div> gzip_disable "MSIE [1-6]\.(?!.*SV1)";</div><div><br></div><div> include /etc/nginx/conf.d/*.conf;</div><div> include /etc/nginx/sites-available/*;</div><div>}</div><div><br>
</div><div><br></div><div>sites-available/www</div><div><br></div><div><div>server {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>listen 80 default;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>server_name <a href="http://blog.foo.com">blog.foo.com</a>;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>access_log /var/log/nginx/foo.access.log;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>error_log<span class="Apple-tab-span" style="white-space:pre"> </span>/var/log/nginx/foo.error.log;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>location / {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>root /var/www2;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>index index.php;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>proxy_pass<span class="Apple-tab-span" style="white-space:pre"> </span><a href="http://127.0.0.1:8080">http://127.0.0.1:8080</a>;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>include /etc/nginx/conf.d/proxy.conf;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>}<span class="Apple-tab-span" style="white-space:pre"> </span></div><div>}</div><div><br></div><div>conf.d/proxy.conf</div><div><div><br></div><div>proxy_redirect off;</div>
<div>proxy_set_header Host $host;</div><div>proxy_set_header X-Real-IP $remote_addr;</div><div>proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</div><div>client_max_body_size 10m;</div><div>client_body_buffer_size 128k;</div>
<div>proxy_connect_timeout 90;</div><div>proxy_send_timeout 90;</div><div>proxy_read_timeout 90;</div><div>proxy_buffer_size 16k;</div><div>proxy_buffers 32 16k;</div><div>proxy_busy_buffers_size 64k;</div>
<div><br></div></div><div><br></div></div><div><br></div><div><br></div></div><div>Now the -i from cURL in <a href="http://blog.foo.com/index.php">blog.foo.com/index.php</a></div><div><div>HTTP/1.1 301 Moved Permanently</div>
<div>Server: nginx/0.8.35</div><div>Date: Sat, 10 Apr 2010 15:34:45 GMT</div><div>Content-Type: text/html; charset=UTF-8</div><div>Connection: keep-alive</div><div>X-Powered-By: PHP/5.2.10-2ubuntu6</div><div>X-Pingback: <a href="http://127.0.0.1:81/xmlrpc.php">http://127.0.0.1:81/xmlrpc.php</a></div>
<div>Location: <a href="http://blog.foo.com:81/">http://blog.foo.com:81/</a></div><div>Vary: Accept-Encoding</div><div>Content-Length: 0</div><div><br></div><div>snip from log file</div><div><div>"GET /index.php HTTP/1.1" 301 0 "-" "curl/7.19.5 (i486-pc-linux-gnu) libcurl/7.19.5 OpenSSL/0.9.8g zlib/<a href="http://1.2.3.3">1.2.3.3</a> libidn/1.15"</div>
</div></div>