I'm using Nginx as a reverse proxy to Apache which is handling PHP, here's my nginx site config:
server {
listen 80 default;
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
root /var/www/www.example.com/httpdocs;
location ~ \.php$ {
proxy_pass http://www.example.com:80;
}
location ~ /\.ht {
deny all;
}
#location / {
try_files $uri @proxy;
#}
location @proxy {
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_buffers 32 4k;
proxy_pass http://www.example.com:81;
}
}
My issue is that requests for index.php
are being returned by nginx unparsed, so my location specifically for handling php files is not doing what it should.
If I request index.php?q=whatever
, which is a valid request for apache, then the site returns a 500 with the error:
2012/07/13 11:22:27 [alert] 8490#0: *17994 4096 worker_connections are not enough while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /index.php?q=whatever HTTP/1.0", upstream: "http://127.0.0.1:80/index.php?q=whatever", host: "www.example.com"