title: Change Nginx root directory to workspace folder path
body: <p><strong>Issue</strong></p>
  
  <p>I installed Nginx with brew on Mac OSX. Then I modified /usr/local/etc/nginx/nginx.conf as below and got a server 500 error:</p>
  
  <pre><code>server {
      listen       666;
      server_name  localhost;
      root /Users/username/Desktop/workspace/projectname/dist;
      location / {
          index index.html;
          try_files $uri $uri/ /index.html;
      }
  }
  </code></pre>
  
  <p><strong>What I tried</strong></p>
  
  <p>I knew that brew install default root is /usr/local/var/www so I was able to get it working by paste dist folder into /usr/local/var/www and update Nginx config like this:</p>
  
  <pre><code>server {
      listen       666;
      server_name  localhost;
      root /usr/local/var/www/dist;
      location / {
          index index.html;
          try_files $uri $uri/ /index.html;
      }
  }
  </code></pre>
  
  <p><strong>Other issue</strong></p>
  
  <p>Even after I paste dist folder into /usr/local/var/www I still got 500 error by updating root like the followings:</p>
  
  <pre><code>root /dist
  root dist
  root ./dist
  </code></pre>
  
  <p>Why does default </p>
  
  <pre><code>root index.html
  </code></pre>
  
  <p>gets displayed when I first run Nginx ? but I have to specify my dist folder with full path like /usr/local/var/www/dist ? Can someone please explain.</p>
  
  <p><strong>Goal</strong></p>
  
  <p>I want to be able to change root directory to my dist folder in workspace so I don't need to paste the dist folder into /usr/local/var/www every time after I rebuild.</p>