Welcome! Log In Create A New Profile

Advanced

PHP Configuration with nginx

Posted by mario198787 
PHP Configuration with nginx
July 04, 2021 11:05AM
Hello everyone,

I try to configure PHP with an nginx server (with this instruction https://www.cyberciti.biz/faq/how-to-install-php-on-opensuse-15-2-15-1/ ), but get 404 NOT FOUND when try URL http://127.0.0.1/index.php . My nginx.conf file:

worker_processes 1;


events {
worker_connections 1024;
use epoll;
}


http {
include mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;


include conf.d/*.conf;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log /var/log/nginx/host.access.log main;

location / {
root /srv/www/htdocs/;
index index.html index.htm;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /srv/www/htdocs/;
}

# PHP config #
location ~ \.php$ {
# 404
try_files $fastcgi_script_name =404;

# default fastcgi_params
include /etc/nginx/fastcgi_params;

# fastcgi settings
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;

# fastcgi params
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
}
}



include vhosts.d/*.conf;

}

What could be a reason of this?
Re: PHP Configuration with nginx
July 04, 2021 11:06AM
Of course index.php in /src/www/htdocs/ exists.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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