skip to Main Content

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;
    }

}

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. Not enough info to solve this problem but here a couple likely issues after seeing your config…

    Of course Dir structure on local files could be many… but keep in mind that 404 likely due to file system structure:

    root /var/www/html/dev-kbd; #given this
    

    Expecting wordpress software to be accessible here:

    /var/www/html/dev-kbd/wp-admin/* 
    /var/www/html/dev-kbd/wp-content/*
    *etc*
    

    You can have whatever you want, but then configs must align.

    Also watch out for alignment of WordPress Admin vs. Site Home settings…

    If your WordPress uses Domain Root as Site Home, should be fine, otherwise tune Nginx + WP but I assume if it was working before and you are sure you copied exact FILE structure, then fine.


    Also Debian/Ubuntu uses default ssl locations as such (not the filenames, the Dirs):

    /etc/ssl/certs/com_domain_www.crt; #chown root:root  #chmod 644
    /etc/ssl/private/com_domain_www.key; #chown root:ssl-cert #chmod 640
    

    This is my #1 guess about problems in the config, as you have ported from CentOS, which is more or less like RHEL.

    If you have customized your User Home with access (permissions) for root/ssl-cert to access your Certs and Private key, then great; but the structure you have presented is concerning for couple reasons…

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search