title: Subdirectory Nginx and React
body: <p>Hi i am new in configuring nginx server and i have a problem:</p>
  
  <p>I have two web applications created with ReactJS which I will call app1 and app2.
  I'd like to show app1 on www.mydomain.com
  and app2 on www.mydomain.com/app2
  it's possible?</p>
  
  <p>This is my Nginx file configuration <code>/etc/nginx/sites-available/default</code></p>
  
  <pre><code>server {
  
      index index.html index.htm index.nginx-debian.html;
  
      server_name xxx.com www.xxx.com;
  
  location / {
      root  /var/www/app1/build;;
  }
  location /app2{
       alias  /var/www/app2/build;;
  }
  </code></pre>
  
  <p>Using this configuration file if I connect to www.domain.com App1 works correctly while if I connect to www.domain.com/app2 the page is completely white and the console gives me these errors:</p>
  
  <pre><code>&lt;noscript&gt;You need to enable JavaScript to run this app.&lt;/noscript&gt;
  </code></pre>
  
  <blockquote>
    <p>2.a90b013e.chunk.js:1 Failed to load resource: the server responded with a status of 404 (Not Found) main.bbc61316.chunk.js:1 Failed to
    load resource: the server responded with a status of 404 (Not Found)</p>
  </blockquote>
  
  <p>﻿</p>