Question

installed wordpress home page display 404

Hi

I had a wordpress installed but suddenly today the home page displays 404 nginx error

after I check the error log those display

2020/12/13 19:23:20 [error] 31432#0: *764 open() "/var/www/html/wordpress/404.html" failed (2: No such file or directory), client: 45.135.186.94, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix$:/run/php-fpm/www.sock", host: "MY IP HERE"

it looks like nginx having some problem then looking for my 404 page but what will be the cause of this ?

I visit http://my_ip_here and encounter 404

but if I visit http://my_ip_here/wp-login.php I can see the login page and can login to admin dashboard.

any ideas ? thanks highly appreciated ! (bow)


user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

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

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        #root         /usr/share/nginx/html;
        root /var/www/html/wordpress;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {

        
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there @stupidboy,

I can see that your location / directive is emply.

Make sure to specify the following in there:

    location / {
        #try_files $uri $uri/ =404;
        try_files $uri $uri/ /index.php$is_args$args;
    }

For more information on how to run WordPress with Nginx check out this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-18-04

Regards, Bobby

Hello,

Refer to below community question, which had the similar issue:

https://www.digitalocean.com/community/questions/wordpress-and-nginx-404-errors-all-but-home-page

Hope this helps! Keep us posted!

Cheers, Lalitha