Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 have 2 application installed on my server using Nginx:

  1. Rails application
  2. wordpress blog

I want that the rails app will be accessible through: and that the wordpress blog will be accessible through:

the site works fine but when i try to access the blog i get "welcome to nginx" screen.

here is my nginx config:

server {
     listen   80;
     rails_env staging;

     access_log /srv/www/staging/www/logs/access.log;
     error_log /srv/www/staging/www/logs/error.log;

     location / {
          root   /srv/www/staging/www/current/trunk/web/public;
          passenger_enabled on;

   server {
        listen       80;

        try_files $uri $uri/ /index.php;
        access_log /srv/www/;
        error_log /srv/www/;

        location ~ \.php$ {
            root /srv/www/;
            include        fastcgi_params;
            fastcgi_pass   localhost:53217;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;


any thoughts?

share|improve this question
up vote 1 down vote accepted

You don't have anything configured for location / for the blog server, which means that if a URL doesn't end in .php, it uses the nginx's default document root.

share|improve this answer
so how do i add th location / so it wont collide with the other subdomain? – Ran May 9 '11 at 8:05
Each server { } section should have its own location / { } clause. They won't conflict. – tylerl May 9 '11 at 8:06
so the blog should have location / { root /srv/www/;} ? – Ran May 9 '11 at 8:08
@Ran: Looks about right. – tylerl May 9 '11 at 8:26

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.