title: Allowing Wordpress to be hosted on a subfolder within an already existing site
body: <p>We have a request from a client where we need to host a wordpress site within our website. By within, I mean that the site can't sit in a subdomain, i.e <a href="https://blog.example.com" rel="nofollow">https://blog.example.com</a>, instead it needs to sit in its own route/subfolder, i.e. <a href="https://www.example.com/blog" rel="nofollow">https://www.example.com/blog</a>. This is due to page ranking (apparently page rankings are penalised if they are put in subdomains)</p>
  
  <p>The issue is, our site isn't run in PHP (its written in Scala that runs on Jetty). Furthermore, our main site is run from a Docker container that is backed by Nginx.</p>
  
  <p>Ideally I would want to host Wordpress on its own single server (either Docker containerized or not, its not a huge issue), and in the nginx configuration for our main site, have it reverse to that external server for the specific URL (i.e. <a href="https://www.example.com/blog" rel="nofollow">https://www.example.com/blog</a> would point to an IP/host of an external server that is running wordpress)</p>
  
  <p>How would you achieve this/is it possible? This is the current <code>nginx.conf</code> for our main server</p>
  
  <pre><code>server {
      listen 80;
      listen [::]:80;
      listen       443 default_server ssl;
      server_name  www.example.com.au;
  
      ssl_certificate      /etc/nginx/cert.crt;
      ssl_certificate_key  /etc/nginx/cert.key;
  
      ssl_session_cache shared:SSL:1m;
      ssl_session_timeout  5m;
  
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_prefer_server_ciphers on;
      ssl_ciphers "EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA256:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EDH+aRSA+AESGCM:EDH+aRSA+SHA256:EDH+aRSA:EECDH:!aNULL:!eNULL:!MEDIUM:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SEED";
  
      add_header Strict-Transport-Security "max-age=31536000; includeSubdomains";
  
      if ($scheme = http) {
          return 301 https://$server_name$request_uri;
      }
  
      location / {
           proxy_pass http://localhost:8080;
           proxy_redirect http://www.example.com.au /;
           proxy_set_header    Host            $host;
           proxy_set_header    X-Real-IP       $remote_addr;
           proxy_set_header    X-Forwarded-for $remote_addr;
           proxy_read_timeout 600s;
           port_in_redirect off;
      }
  }
  </code></pre>
  
  <p>This is an example of our current <code>nginx.conf</code>, as you can see, the actual website is being hosted on <code>localhost:8080</code> and we are just proxy redirect for the main site.</p>