Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I installed nginx and would like to setup wordpress as a final step. I followed many howtos but am unable to get it working.

The setup is fairly straightforward, the root dir of the webserver is /data/Sites/ In that root dir I created a symlink to the wordpress folder in /usr/local/wordpress, so in fact all wordpress files can be accessed at /data/Sites/ Permissions are ok.

The plan is to get wordpress working at http://sirius/wordpress, the server's name is sirius. spawn-fcgi is running and listening on port 7777.

Here you can see the relevant config:

server {
    listen       80;
listen       8080;
    server_name  sirius;

root /data/Sites/;
passenger_enabled on;
    passenger_base_uri /redmine;

    #charset koi8-r;

    #access_log  logs/access.log  main;

location ^~ /data {
   root /data/Sites/;
   autoindex on;
   auth_basic "Restricted";
   auth_basic_user_file htpasswd;

    location ^~ /dump {
        root   /data/Sites/;
        autoindex on;

location ^~ /wordpress {
       try_files $uri $uri/ /wordpress/index.php;

# pass the PHP scripts to FastCGI server listening on
    location ~ \.php$ {
    #fastcgi_split_path_info ^(/wordpress)(/.*)$;
        fastcgi_pass   localhost:7777;
        #fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    #index     index.php;

please note that redmine, and the locations dump and data are working perfectly, it is only wordpress that I cannot get to work.

Can you please help me to the correct wordpress configuration in nginx? All help is much appreciated!

share|improve this question
Remeber that Igor Sysoev (nginx author) strongly disagree with running apps on nginx. He is very taxative that nginx is to be used as a proxy between the outside and app servers. – coredump Feb 18 '11 at 21:18

From what I've seen the main thing to get wordpress working is to translate the mod_rewrite rules into nginx format. The format is:

if (!-e $request_filename)
    rewrite ^(.+)$ /index.php?q=$1 last;

You are also missing

root /path/to/wordpress

In that subsection.

Otherwise, is there a particular error you are seeing? What do the error logs show?

share|improve this answer
I added the rewrite and root parts in location ~ \.php$ error.log gives no errors, when i try to load sirius/wordpress in the browser it shows a popup to download a BIN file; file content is php source from wordpress: define('WP_USE_THEMES', true); /** Loads the WordPress Environment and Template */ require('./wp-blog-header.php'); – nkr1pt Feb 18 '11 at 21:13
with editing and trying the nginx config file I also noticed 'input file is not specified' which seems to come from wordpress – nkr1pt Feb 18 '11 at 21:17

Use a server level rewrite. You should adjust all other locations. Oh and BTW, your setup is insecure. You should use a nested location or fastcgi_split_path_info. You can check my WP config on github for a nested location approach.

Anyway here's your request answered:

 rewrite ^ http://$host/wordpress$request_uri? permanent;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.