I've spent a lot of hours being stuck, see the thing is that Nginx works with images and javascript, css and all static files great. Now the problem arises when I try to get Nginx to use Apache to serve php files. Nginx just refuses to allow Apache to server php files. note: I have my actual site url where it says mysite.com. I also must note that this still happens when nginx is listening on port 80 and apache is listening on 8080. I'm testing things backwards because I have active sites and no test server.
Here's mysite conf in /etc/nginx/sites-enabled:
[code]
server {
listen 8080;
server_name mysite.com alias www.mysite.com;
#access_log logs/mysite.access.log main;
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;
location ~ \.php$ {
proxy_pass http://127.0.0.1:80;
}
location / {
index index.html index.htm index.php index.shtml;
root /home/mysite/public_html;
}
}
[/code]
And here's my nginx.conf:
[code]
user nobody;
worker_processes 2;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include 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 logs/access.log main;
server_names_hash_bucket_size 64;
sendfile on;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_comp_level 5;
gzip_http_version 1.0;
gzip_min_length 0;
gzip_types text/plain text/css image/x-icon
application/x-javascript;
gzip_vary on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
[/code]
Edited 1 time(s). Last edit at 08/12/2009 08:09PM by goldcard.