wordpressnginx

Wordpress Nginx 404 Not Found


I just migrating my Multisite WordPress from old server (centos) to new server (ubuntu22) with nginx, php8.1-fpm, mysql. I'm sure all of my configuration is correct but browser always display 404 not found

server {
    listen 80 default_server;
    listen 443 ssl default_server;
    ssl_certificate /home/bagwi2024/ssl/example.com.ssl;
    ssl_certificate_key /home/bagwi2024/ssl/example.com.key;
    #ssl_prefer_server_ciphers on;
    server_name example.com;
    access_log /var/www/html/access.log;
    error_log /var/www/html/error.log;
    root /var/www/html/dev-kbd;
    index index.php index.html index.htm index.nginx-debian.html;

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

    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php8.1-fpm.sock;
    }

    location ~ /\.ht {
            deny all;
    }

}


Solution

  • I found my mistake is not following WordPress documentation about Nginx Advance Administration Server (https://developer.wordpress.org/advanced-administration/server/web-server/nginx/). Now My website running perfectly.

    My configuiration for WordPress Multisite Subdirectories

    https://github.com/ahmadbagwi/Nginx-WordPress-Multisite