Search code examples
wordpressnginxserve

404 - Other permalink after transfer from localhost(apache) to nginx server


I've transferred Wordpress site from localhost(apache) to Live server(nginx) only default link is working and also follow General WordPress rules in codex but I couldn't find the file path /etc/nginx/global/ or /etc/nginx/conf/global

When I search .conf file it only shows this files:

/home/wwwroot/my-domain/etc/nginx-host-subdomain-template.conf
/home/wwwroot/my-domain/etc/nginx-host-template.conf
/home/wwwroot/my-domain/etc/php5.2-fpm-template.conf
/home/wwwroot/my-domain/etc/php-fpm-template.conf
/home/wwwroot/my-domain/etc/main.conf
/home/wwwroot/my-domain/php-fpm/go123.conf
/home/wwwroot/my-domain/vhost/go123.conf
/home/wwwroot/my-domain/rewrite/amh.conf

Don't know what file to edit to insert the code in codex. My first time to use nginx


Solution

  • After those trial and error finally make it works. The main problem is that mod_rewrite wasn't enable so I figured it out the file was located here /home/wwwroot/my-domain/rewrite/amh.conf and made a rewrite rule for nginx server. Here is the code:

    location / {
            index index.php index.html;
            if (!-e $request_filename)
            {
                    rewrite ^/(.+)$ /index.php last;
            }
    }
    

    Cheers!