Welcome! Log In Create A New Profile

Advanced

NginX problem with Reverse Proxy'ing

Victor
April 10, 2010 11:40AM
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 127.0.0.1:8080

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.
Here I include the config files loaded in Nginx:

Nginx.conf
user www-data;
worker_processes 1;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
# multi_accept on;
}

http {
include /etc/nginx/mime.types;

access_log /var/log/nginx/access.log;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;

gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-available/*;
}


sites-available/www

server {
listen 80 default;
server_name blog.foo.com;

access_log /var/log/nginx/foo.access.log;
error_log /var/log/nginx/foo.error.log;

location / {
root /var/www2;
index index.php;
proxy_pass http://127.0.0.1:8080;
include /etc/nginx/conf.d/proxy.conf;
}
}

conf.d/proxy.conf

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;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 16k;
proxy_buffers 32 16k;
proxy_busy_buffers_size 64k;




Now the -i from cURL in blog.foo.com/index.php
HTTP/1.1 301 Moved Permanently
Server: nginx/0.8.35
Date: Sat, 10 Apr 2010 15:34:45 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.2.10-2ubuntu6
X-Pingback: http://127.0.0.1:81/xmlrpc.php
Location: http://blog.foo.com:81/
Vary: Accept-Encoding
Content-Length: 0

snip from log file
"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/1.2.3.3 libidn/1.15"
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

NginX problem with Reverse Proxy'ing

Victor April 10, 2010 11:40AM

Re: NginX problem with Reverse Proxy'ing

Maxim Dounin April 10, 2010 02:08PM

Re: NginX problem with Reverse Proxy'ing

Victor Fondevilla April 10, 2010 03:20PM

Re: NginX problem with Reverse Proxy'ing

Victor Fondevilla April 10, 2010 03:22PM

Re: NginX problem with Reverse Proxy'ing

Maxim Dounin April 10, 2010 03:58PM

RE: NginX problem with Reverse Proxy'ing

Victor Fondevilla April 11, 2010 09:20AM

Re: NginX problem with Reverse Proxy'ing

Maxim Dounin April 11, 2010 10:50AM

RE: NginX problem with Reverse Proxy'ing

Victor Fondevilla April 13, 2010 03:34PM

Re: NginX problem with Reverse Proxy'ing

Victor Fondevilla April 11, 2010 02:32AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 60
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready