Answer the question
In order to leave comments, you need to log in
Nginx + php-fpm file not found why?
Installed nginx + php-fpm, set up a file for nginx and created a rule in it to redirect to index.php:
upstream php-handler {
server unix:/run/php/php7.0-fpm.sock;
}
server{
listen 80;
server_name education.clouder.xyz;
root /var/www/education/;
index index.php;
location / {
try_files $uri $uri/ =404;
rewrite ^(.+)$ /index.php?url=$1;
}
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
}
}
Answer the question
In order to leave comments, you need to log in
Remove upstream
and write in location
Restart nginx and check
Try like this:
server{
listen 80;
server_name education.clouder.xyz;
root /var/www/education/;
index index.php;
location / {
try_files $uri $uri/ =404;
rewrite ^(.+)$ /index.php?url=$1;
}
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000; # listen for a port
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question