News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

404 Not Found

Started by Macostick, March 30, 2021, 12:10:00 AM

Previous topic - Next topic

Macostick

Good morning all !

I come asking for help because it's been a while that I block on a problem but I have not seen good answers anywhere.


With Debian 10, I installed NGINX 1.19.8

NGINX configuration:

server {
    listen 80 default_server;
    listen [::]:80 default_server;


    root /var/www/html;

    index index.html index.htm index.nginx-debian.html;

    server_name mywebsite.com;

    location / {

        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
    }

}



When I go on my link I see well: Welcome to nginx!

So I have UNZIP the simple archive machine forum in / var / www / html / but when I want to go to settings.php this shows me: 404 NOT FOUND

Does anyone know where can the problem come from?  :o

Thank you

Kindred

well, first of all -- you can not EVER access Settings.php directly

(also Linux is case sensitive settings.php is different from Settings.php)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

m4z

Is your nginx setup for PHP? Other than f.e. apache, nginx can't handle FCGI itself, so you need something like PHP-FPM:

1). Install support for CGI:

apt install install php5-fpm


Edit: I'm not sure if php5 is still the default on D10 (try php7-fpm instead); these instructions are for D8.


2.) Then, nginx needs to use it (so it knows what to do with .php files). Create a file "/etc/nginx/conf.d/global/php.conf" (official docs):

location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        if (!-f $document_root$fastcgi_script_name) {
                return 404;
        }
        # Mitigate https://httpoxy.org/ vulnerabilities
        fastcgi_param HTTP_PROXY "";
        fastcgi_pass unix:/run/php5-fpm.sock;

        # include the fastcgi_param setting
        #include fastcgi_params;
        #
        # SCRIPT_FILENAME parameter is used for PHP FPM determining
        # the script name. It is not set in fastcgi_params, but
        # in fastcgi.conf
        include fastcgi.conf;
}


3.) Next, include this file from your vhost file (inside the "server" block):

include conf.d/global/*.conf;


4.) Reload nginx to verify everything works:

systemctl reload nginx


5.) Replace the "index [...]" line in your vhost (inside the "server" block) with:

index index.php;


6.) Reload nginx again to verify everything works:

systemctl reload nginx
"Faith is what you have in things that don't exist."
--Homer Simpson

Es gibt hier im Forum ein deutsches Support-Board!

Macostick

Thank you m4z I succeeded thanks to you  ;)

Advertisement: