I am still learning nginx, so please bear with me if the answer is obvious :).
I have set up nginx in front of apache using these instructions
nginx seems to be properly processing html files, however anytime I try and access a php file I get a 404 error.
here is the nginx example.com conf file
server {
listen 80;
access_log /var/www/example.com/logs/nginx.access.log;
error_log /var/www/example.com/logs/nginx.error.log;
root /var/www/example.com/prod;
index index.php index.html index.htm;
server_name www.example.com example.com;
location \ {
try_files $uri $uri/ index.php/$uri;
}
location ~* ^.*\.php$ {
if (!-f $request_filename) {
return 404;
}
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8080;
}
location ~ /\.(ht|git) {
deny all;
}
}
and here is my apache example.com conf file
<VirtualHost 123.45.67.89:8080>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@example.com
#Indexes + Directory Root
DirectoryIndex index.html index.htm index.php
DocumentRoot /var/www/example.com/prod/
#CGI Directory
ScriptAlias /cgi-bin/ /var/www/example.com/prod/cgi-bin/
<location /cgi-bin>
Options +ExecCGI
</location>
#Log Files
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
</VirtualHost>
I’ve been trying to figure out where my error is for the better part of 4 hours now. I am hoping you might be able to help 🙁
proxy_pass http://127.0.0.1:8080;and<VirtualHost 123.45.67.89:8080>doesn’t look the same.
And nginx config looks wrong. Maybe you will have better luck if you read the official documentation.