Title: WordPress with Nginx causing URL issues
Last modified: August 20, 2016

---

# WordPress with Nginx causing URL issues

 *  [sameermanas](https://wordpress.org/support/users/sameermanas/)
 * (@sameermanas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/)
 * Hi everyone,
 * I recently igrated my website from another server and thought it would be better
   if changed from Apache to Nginx.
 * My website is running on Nginx and Ubuntu. The problem is that homepage displays
   just fine but the articles when opened throw a 404 error.
 * However if i change the permalinks to ?p=123 then everything works fine. But 
   i badly need the custom permalink structure for the site.
 * I’ve tried three to four different config files for Nginx but they don’t work
   either.
 * Can anyone help me out with the Nginx server issue. This is my web URL
    [http://www.bloggerstack.com](http://www.bloggerstack.com)
 * Thanks in advance.

Viewing 14 replies - 1 through 14 (of 14 total)

 *  [Arnoud](https://wordpress.org/support/users/strangefreedom/)
 * (@strangefreedom)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662312)
 * I think this is what you are looking for: [Nginx compatibility plugin](http://wordpress.org/extend/plugins/nginx-compatibility/)
 *  Thread Starter [sameermanas](https://wordpress.org/support/users/sameermanas/)
 * (@sameermanas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662328)
 * I already installed that plugin but there is no effect yet :/
 * I guess the nginx conf files need some more code, but i am not well versed with
   the code.
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662343)
 * It looks like you are using PHP-FPM to serve PHP files. Also, it is advisable
   to disable W3 Total Cache until the permalinks issue is resolved. Please post
   your nginx conf. As it would be more than 10 lines, please consider using pastebin.
   Kindly remove any domain related info from there. Without looking at your nginx
   conf, it’s not possible to help.
 *  Thread Starter [sameermanas](https://wordpress.org/support/users/sameermanas/)
 * (@sameermanas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662379)
 * Here is the Nginx.conf.
 * I had to use piratepad since pastebin wasn’t working at the time.
 * [http://piratepad.net/nQbG669fqs](http://piratepad.net/nQbG669fqs)
 * This configuration was actually from [https://github.com/perusio/wordpress-nginx](https://github.com/perusio/wordpress-nginx)
 * It was created for nginx and wordpress, so i gave it a try. But none of them 
   are working for me.
 * [@pothi](https://wordpress.org/support/users/pothi/) Kalimuthu: If you want to
   take a look into all the files, I can provide you my credentials sir.
 * Thanks in advance.
 *  [Arnoud](https://wordpress.org/support/users/strangefreedom/)
 * (@strangefreedom)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662394)
 * Do you know if you are using php-fpm?
    Do you have any files in /etc/nginx/sites-
   enabled/? If so, please paste the contents here.
 * Can you tell the version number of nginx and php?
    Have you studied [http://wiki.nginx.org/Configuration](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/nginx wiki?output_format=md)(
   don’t forget [the pitfalls](http://wiki.nginx.org/Pitfalls)).
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662407)
 * [@sameermanas](https://wordpress.org/support/users/sameermanas/) As Arnoud mentioned,
   please provide us the site specific nginx configuration. It is faster to get 
   help here than directly from me. That said, you’re welcome to provide me the 
   credentials so that I can have a look and post the solution here. I hope you 
   know how to contact me.
 *  Thread Starter [sameermanas](https://wordpress.org/support/users/sameermanas/)
 * (@sameermanas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662425)
 * @ Arnoud I am using Php-Fpm and i have the [sitename].conf file in the sites-
   available folder(Not inside sites-enabled). Sites-enabled is not touched till
   now.
 * The PHP version is 5.3.6 and Nginx is 1.0.5
 * Yes i have been through the configuration details but unfortunately i haven’t
   been through the pitfalls thing.
 * [@pothi](https://wordpress.org/support/users/pothi/) Kalimuthu: Here is the file
   of /etc/nginx/sites-available/bloggerstack.com.conf
 * [http://piratepad.net/hFhfRqvZ6D](http://piratepad.net/hFhfRqvZ6D)
 * I have sent the details to you via Facebook. Please go through them once.
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662428)
 * [@sameermanas](https://wordpress.org/support/users/sameermanas/) Got the login
   info and fixed your site’s nginx configuration that was missing the following
   directive…
 * `location / { try_files $uri $uri/ /index.php?$args; }`
 *  Thread Starter [sameermanas](https://wordpress.org/support/users/sameermanas/)
 * (@sameermanas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662429)
 * Thank you very much sir. Is there anything else i should do further to ensure
   less conflicts.
 * Also since you asked me to disable W3Total Cache, I did that immediately.
 * However in order to make sure that the Nginx and other related tools work fast,
   Are there any other plugins or codes that make WordPress faster and less resource
   hungry.
 * Thank you very much once again for the help Pothi Kalimuthu Sir
 * [@arnoud](https://wordpress.org/support/users/arnoud/) : Thank you very much 
   for taking the time to look through this. Also can you suggest any changes that
   are needed for the “sites-available” and “sites-enabled” folders.
 * I really don’t understand what difference they make.
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662443)
 * You’re welcome Sameer. From my experience, Nginx with PHP-FPM either works or
   doesn’t work. 🙂
 * > Also since you asked me to disable W3Total Cache, I did that immediately.
 * You may enable it now and please make sure to reload Nginx once you enable it
   so that the custom rules from W3 Total Cache are applied.
 * > However in order to make sure that the Nginx and other related tools work fast,
   > Are there any other plugins or codes that make WordPress faster and less resource
   > hungry.
 * There are a lot of optimization techniques available on the internet. You may
   want to start from here… [http://codex.wordpress.org/WordPress_Optimization](http://codex.wordpress.org/WordPress_Optimization)
 *  Thread Starter [sameermanas](https://wordpress.org/support/users/sameermanas/)
 * (@sameermanas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662445)
 * Thank you all for your time !
 * Finally one simple question. If i host a new website on the same VPS, can i use
   the same conf file in site-available (Of course i will change the domain to newdomain.
   com in the links)
 * Like /nignx/sites-available/domainone.com.conf
    /nginx/sites-available/domaintwo.
   com.conf . . etc
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662447)
 * > If i host a new website on the same VPS, can i use the same conf file in site-
   > available
 * Yes, why not. It may be sites-enabled, though. I don’t remember where I made 
   the change. 🙂
 *  Thread Starter [sameermanas](https://wordpress.org/support/users/sameermanas/)
 * (@sameermanas)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662470)
 * Hi Everyone,
 * I got that issue fixed after adding a line in Webmin. This is for Webmin enabled
   users, so make sure you have WEbmin installed.
 * Go To Webmin>Servers>Nginx Webserver
 * In that select the Edit Configuration Files option.
 * Then select your /etc/nginx/sites-available/yourdomainname.com
 * You will see something like this:
 *     ```
       server {
       	server_name sameermanas.com www.sameermanas.com;
       	listen 69.85.88.135;
       	root /home/sameermanas/public_html;
       	index index.html index.htm index.php;
       	access_log /var/log/virtualmin/sameermanas.com_access_log;
       	error_log /var/log/virtualmin/sameermanas.com_error_log;
       	fastcgi_param GATEWAY_INTERFACE CGI/1.1;
       	fastcgi_param SERVER_SOFTWARE nginx;
       	fastcgi_param QUERY_STRING $query_string;
       	fastcgi_param REQUEST_METHOD $request_method;
       	fastcgi_param CONTENT_TYPE $content_type;
       	fastcgi_param CONTENT_LENGTH $content_length;
       	fastcgi_param SCRIPT_FILENAME /home/sameermanas/public_html$fastcgi_script_name;
       	fastcgi_param SCRIPT_NAME $fastcgi_script_name;
       	fastcgi_param REQUEST_URI $request_uri;
       	fastcgi_param DOCUMENT_URI $document_uri;
       	fastcgi_param DOCUMENT_ROOT /home/sameermanas/public_html;
       	fastcgi_param SERVER_PROTOCOL $server_protocol;
       	fastcgi_param REMOTE_ADDR $remote_addr;
       	fastcgi_param REMOTE_PORT $remote_port;
       	fastcgi_param SERVER_ADDR $server_addr;
       	fastcgi_param SERVER_PORT $server_port;
       	fastcgi_param SERVER_NAME $server_name;
       	location ~ \.php$ {
       		fastcgi_pass localhost:9003;
       	}
   
       	location / { try_files $uri $uri/ /index.php?$args; }
   
       }
       ```
   
 * Notice the line called “location / { try_files $uri $uri/ /index.php?$args; }”
 * That is the line I added in the end. It fixes your Permalinks issues.
 * At last make sure you click Save and then click on Apply Nginx Configuration
 * Hope this helps anyone out there like me.
 *  [Todd Lahman](https://wordpress.org/support/users/toddlahman/)
 * (@toddlahman)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662505)
 * [http://wiki.nginx.org/Wordpress](http://wiki.nginx.org/Wordpress)
 * The fastcgi_param can be included in a separate file as shown in the working 
   example to simplify the nginx.conf file.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘WordPress with Nginx causing URL issues’ is closed to new replies.

## Tags

 * [nginx](https://wordpress.org/support/topic-tag/nginx/)
 * [ubuntu](https://wordpress.org/support/topic-tag/ubuntu/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 14 replies
 * 4 participants
 * Last reply from: [Todd Lahman](https://wordpress.org/support/users/toddlahman/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/wordpress-with-nginx-causing-url-issues/#post-2662505)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
