title: Nginx proxy_pass to another port with Wordpress
body: <p>My problem is following: I use Wordpress on Nginx with "pretty links". I also run 2 other services on ports 88 and 1234 and I want to make a subdomains bugs.mydomain and mail.mydomain. I did the proxypass on location / but it's working only for the main directory, anything that is after the domain/ is falling into Wordpress "pretty links" mechanism. Do you have any idea how to solve this? My config files below:
  The server config:</p>
  
  <pre><code>server {
      listen   &lt;IP&gt;:80;
  
      root /usr/share/nginx/www/domain;
      index index.html index.htm index.php;
  
      server_name domain www.domain;
  
      location / {
              try_files $uri $uri/ /index.html;
              if ( $host ~ "bugs.domain" ) {
                  proxy_pass http://domain:88;
              }
  
              if ( $host ~ "mail.domain" ) {
                  proxy_pass http://domain:1234;
              }
      }
  
      location /doc/ {
              alias /usr/share/doc/;
              autoindex on;
              allow 127.0.0.1;
              deny all;
      }
  
      location ~ \.php$ {
              try_files $uri =404;
              fastcgi_split_path_info ^(.+\.php)(/.+)$;
              fastcgi_pass unix:/var/run/php5-fpm.sock;
              fastcgi_index index.php;
              include fastcgi_params;
      }
  
      location ~ /\.ht {
              deny all;
      }
  
      include /home/domain/public_html/nginx.conf;
      }
  </code></pre>
  
  <p>the config for specified domain (with Wordpress):</p>
  
  <pre><code>#First there is many rewrites for the W3TC plugin, like minification, caches etc
  if ($host ~* ^www\.(.*))
  {
      set $host_without_www $1;
      rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
  }
  #
  # unless the request is for a valid file, send to bootstrap
  if (!-e $request_filename)
  {
      rewrite ^(.+)$ /index.php?q=$1 last;
  }
  </code></pre>
  
  <p>Now, when I enter domain:88 or domain:1234 it works. When I enter bugs.domain the website loads, but no CSS or images works as the url is bugs.domain/somapath and this falls into the Wordpress bootstrap. I run out of the ideas.</p>