title: How to forward one domain in nginx to different subdirectories (php, rails)?
body: <p>I own a VPS server for development which runs on Ubuntu server 14.04 x64 LTS. I have some RoR sites and some Wordpress ones. I want to be able to play with them by git pushing them to separate directories.
  That means that I should have a rails website in xxx.xxx.xxx.xxx/myrailsweb and another wordpress website in xxx.xxx.xxx.xxx/mywpweb. How do I achieve this with server blocks in nginx ?</p>
  
  <pre><code>server {
      listen 80 default_server;
      listen [::]:80 default_server ipv6only=on;
  
      root /usr/share/nginx/html;
      index index.php index.html index.htm;
  
      server_name 127.0.0.1;
  
      location /apps/testphp {
          try_files $uri $uri/ =404;
      }
  
      error_page 404 /404.html;
      error_page 500 502 503 504 /50x.html;
      location = /50x.html {
          root /usr/share/nginx/html;
      }
  
      location ~ \.php$ {
          try_files $uri =404;
          fastcgi_split_path_info ^(.+\.php)(/.+)$;
          fastcgi_pass unix:/var/run/php5-fpm.sock;
          fastcgi_index index.php;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          include fastcgi_params;
      }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>server {
    listen 80 default_server;
    # server_name 127.0.0.1;
    passenger_enabled on;
    passenger_app_env development;
    root /home/myname/apps/testapp/public;
  }
  </code></pre>
  
  <p>Any ideas ?</p>