Welcome! Log In Create A New Profile

Advanced

Nginx php reverse proxy problem

February 12, 2020 07:43AM
Hi,
I'm running a reverse proxy with nginx and using certbot for ssl. It's been working great but recently with an php server installation it's been giving me problems.
I get access to the index but any other page I get a 404 error from nginx.

404 Not Found
nginx/1.14.0 (Ubuntu)

This is my conf file
server {

root /var/www/YOUR_DIRECTORY;
index index.php index.html index.htm;

###################################################
# Change "yoururl.com" to your host name

server_name my-domain;

# location / {
# try_files $uri $uri/ /index.php?q=$uri&$args;
# }

location /site/ {
if (!-e $request_filename){
rewrite ^/site/(.*)$ /site/index.php break;
}
}location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param PATH_TO_FRAMEWORKS /var/www/frameworks/;
fastcgi_param CORE_TYPE frameworks;
fastcgi_param IS_DEV true;
include fastcgi_params;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location ~ /\. {
deny all;
}

location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}location / {
proxy_pass http://my-server-ip/;
}





listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/my-domain/fullchain.pem; #$
ssl_certificate_key /etc/letsencrypt/live/my-domain/privkey.pem;$
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
server {
if ($host = my-domain) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;

server_name my-domain;
return 404; # managed by Certbot


}


Any had similar problems? It's nginx having a different configuration for php?
Just in case I have tried commenting the last lines which appears to send the 404, but it did the same thing.
Subject Author Posted

Nginx php reverse proxy problem

adrian.hilt February 12, 2020 07:43AM

Re: Nginx php reverse proxy problem

Francis Daly February 18, 2020 06:38PM

Re: Nginx php reverse proxy problem

adrian.hilt February 20, 2020 08:10AM

Re: Nginx php reverse proxy problem

Francis Daly February 20, 2020 09:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 85
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