Reputation: 504
I have PHP 7.2.17 and Nginx 1.15.9 on Ubuntu 19.04. I have this nginx configuration :
server {
listen 80;
listen [::]:80;
server_name dev.frameworkcms.com;
set $rootpath "/var/www/html/perso/framework-cms test";
error_log "/var/www/html/perso/framework-cms test/logs/error.log" error;
# combined by default
access_log "/var/www/html/perso/framework-cms test/logs/access.log";
root $rootpath/web;
location ~ \.php$ {
fastcgi_intercept_errors on;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index Resources.php;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php7.2-fpm.sock;
}
}
I tried with the port 9000 as well.
i can see the index.html at the project root but not the file web/Resources.php
.
I always have a 502 Bad Gateway
. Logs are empty.
Edit
I just added a line try_files \$uri /Resources.php;
at the beginning of the location
block. Now the php file is offered for download...
Edit
Thanks to @Pete Cooper, I have found that the .sock
file is not the good one.
Here is the new version of the file :
server {
listen 80;
listen [::]:80;
server_name dev.frameworkcms.com;
set $rootpath "/var/www/html/perso/framework-cms test";
error_log "/var/www/html/perso/framework-cms test/logs/error.log" error;
# combined by default
access_log "/var/www/html/perso/framework-cms test/logs/access.log";
root $rootpath/web;
location ~ \.php$ {
try_files \$uri /Resources.php;
fastcgi_intercept_errors on;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index Resources.php;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
}
I now have a 500 Internal Server Error. I precise that I work locally.
Upvotes: 0
Views: 601