VPSMATE

  • HOME
  • NEWS
  • VPS
  • DEDICATED
  • ARCHIVES
  • GoDaddy
  • SCRIPT
  • TOOLS
    • Traceroute
    • Benchmark
    • Useful Sites
  • Themes
  • GFW
VPSMATE
VPS COUPON & PROMOS | VPS & DEDICATED SERVERS OFFERS | VPS REVIEWS
  1. Main page
  2. Tips
  3. Main content

Webuzo - Nginx rewrite rule for Wordpress

16/09/2014 8449hotness 0likes 0comments

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

 

 

Related

Tag: Nothing
Last updated:16/09/2014

kyaky

This person is a lazy dog and has left nothing

Like
< Last article
Next article >

Comments

Cancel

This site uses Akismet to reduce spam. Learn how your comment data is processed.

COPYRIGHT © 2021 vpsmate.net. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang