Reputation: 62
This is config of nginx.conf
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /Users/*name*/PHPSITE/standard;
index index.html index.htm;
try_files $uri $uri/ /index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /Users/*name*/PHPSITE/standard;
}
location ~ \.php$ {
include /usr/local/etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_param SCRIPT_FILENAME /Users/*name*/PHPSITE/standard$fastcgi_script_name;
}
}
But when I'm running on 127.0.0.1:9000 it doesn't work. On localhost it shows 403 Forbidden. As you can see, I deleted commented lines.
Upvotes: 1
Views: 2430
Reputation: 2943
You should always use $document_root
instead providing root path everywhere
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
And check if your php-fpm process is running, for example if you are using systemctl run
systemctl status php-fpm
systemctl start php-fpm
also check if you are using same fast_cgi path, it should match in www.conf of php-fpm file ( could be here /etc/php-fpm.d/www.conf)
listen = 127.0.0.1:9000
and your site config nginx.conf file
fastcgi_pass 127.0.0.1:9000;
after updating files restart your Nginx/php-fpm services.
and than visit http://localhost (as you set server_name above) in your browser , not 127.0.0.1:9000.
Upvotes: 2