How to configure Nginx for Wordpress permalinks

Originally published at: https://www.cyberciti.biz/faq/how-to-configure-nginx-for-wordpress-permalinks/

I switched from Apache to Nginx web server. How do I configure permalinks under WordPress blog? How can I configure Nginx for Wordpress permalinks using virtual hosting?

2 Likes

Please give an example of njnx configuration for vps (ex linode) hosting for more than one wordpress sites, for security, permanent links and please mention the names of the configuration files that we have to change, because for ex in your post you mention to change the sites enabled but i cannot change that file (so i changed sites available)

Thanks

@PanosZ what kind of problems are you having? Usually, you create per domain config in /etc/nginx/sites-available/ directory. Like:

  1. For domain domain-one-com create kbd> /etc/nginx/sites-available/domain-one-com.conf
  2. For domain domain-two-com create kbd> /etc/nginx/sites-available/domain-two-com.conf

Next symlink using the ls command on Linux in /etc/nginx/sites-enabled/ directory:

cd /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/domain-one-com.conf .
ln -s /etc/nginx/sites-available/domain-two-com.conf .

That is all. Restart nginx and it should work.

Amazing solution! Your solution works perfectly. For my sites conf file i went to

/etc/nginx/vhosts/www-root/

instead of the provided url. Maybe you should include it. In the begging i tried changing the default.conf as i was not sure.

Stathis D.