Once you setup a wordpress site using nginx, you need to add certain rules to the nginx.conf file for your domain in sites-available/ directory. If you don’t then you’ll get error 404 while browser the inner pages of your site, even if the homepage loads fine.
WordPress nGinx configuration rules
First rule to add is a location block as follow:
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
}
Restart nGinx server
Make sure that you restart the nginx server after making changes to any nginx.conf file.
You can restart the nginx service by using this command:
service nginx restart
If your configurations are fine, then it will restart nginx without any error. However if there is any error in any conf file, then it will give an error and will not restart the server to avoid any disruption in service.