People find unable to get permalink work in Wordpress when use Nginx stack. It's because Nginx rewrite rule for Wordpress has been set up.
Follow the instruction below to get this done.
At the beginning, I thought the following method was alright till I found out it was generated by Webuzo and gets overwritten by Webuzo every time you make site configuration change.
nano /usr/local/apps/nginx/etc/conf.d/webuzoVH.conf
Add:
if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; }
make it look like:
server { listen 80; server_name yoursite.com www.yoursite.com; # The Document Root root /home/admin/www/yoursite.com; error_log /usr/local/apps/nginx/var/log/yoursite.com.err; access_log /usr/local/apps/nginx/var/log/yoursite.com.log main; include /usr/local/apps/nginx/etc/conf.d/common; if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; } }
restart nginx
service nginx restart
So, let add the rewrite in /usr/local/apps/nginx/etc/conf
.d
/common
add the following to the file:
#For wordpress if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q=$1 last; }
Then, restart nginx
service nginx restart
Comments