How To Configure Nginx For Wordpress Website in aaPanel?

I have been using apache for quite a long time. I am using aaPanel for managing the server. aaPanel is a web-based control panel. aaPanel provides the one-click function such as one-click install LNMP/LAMP developing environment. So I can both get apache or Nginx.

Installing WordPress with apache build is very easy, just add the website and upload WordPress files. but recently I want to move my website to Nginx (as everyone recommends Nginx) but here comes the problem, when I upload my WordPress website home page loads fine but the single page shows a 404 error.

I searched google and find out that I need to configure Nginx to get it working. But Nginx is too complicated, where in apache wordpress default provide .htaccess which handle everything but in Nginx there is nothing. Can anyone help me setup the website?

In aaPanel everything is pretty much preconfigured. After adding a new website, go to the website configuration. Go to URL rewrite and paste the following codes.
nginx-configuration-wordpress-aapanel.md.jpg

location = /favicon.ico {
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}

location / {
    try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
    include fastcgi_params;
    fastcgi_intercept_errors on;
    #fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass unix:/tmp/php-cgi.socket;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    expires max;
    log_not_found off;
}

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

You can also use the default wordpress config provided by aaPanel.

nginx-configuration-wordpress-aapanel-default.md.jpg