Answers.Body: <p>If you want to just adjust the folder for the webroot set the root to</p>
  
  <p>/srv/www/webroot/articles/</p>
  
  <p>And in the index.php file make sure the path to the craft folder is</p>
  
  <p>'../../app/craft'</p>
  
  <p>UPDATE:</p>
  
  <p>If you instead want to leave the webroot as is and just have craft run from yourdomain.com/articles you would need to also update the index.php to make sure the craft path is set correct</p>
  
  <p>and in the nginx file add this</p>
  
  <pre><code>location /articles/ {
    try_files $uri $uri/ @rewrites;  
  }
  
  location @rewrites {
     rewrite ^/articles/(.*)$ /articles/index.php?p=$1 last;
  }
  </code></pre>
  
  <p>put that directly above this line, everything else can be the same</p>
  
  <pre><code>location ~ \.php$ {
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-12T04:01:50.750Z
Answers.Text: Actually, the purpose of this sub-directory is that I have another app running from the webroot/, I can't point the server root to articles/. (index.php is set to point to ../../app/craft, and I do get 404 pages from Craft, but not much more.
Answers.UserDisplayName: Mathieu P.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-12T04:06:46.297Z
Answers.Text: ok let me update my answer then
Answers.UserDisplayName: Keith Mancuso
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-12T04:57:29.857Z
Answers.Text: Keith, I think it worked.  Initially I still got the 404, but calling /articles/admin/install fired the install process.   It ended with a Oops page, but nothing alarming in the craft.log, and all looks operational so far.  I will do more testing.
Answers.UserDisplayName: Mathieu P.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-12T06:32:28.097Z
Answers.Text: Once inside the CP, I had to add /articles to the end of the site URL under the General Settings, is this normal or should that have been set automatically during install?
Answers.UserDisplayName: Mathieu P.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-12T07:10:47.767Z
Answers.Text: Yea that's normal.  You can also just site the siteurl in the general.config but craft expects that to be the root of any craft urls it will build
Answers.UserDisplayName: Keith Mancuso
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-12T03:57:24.380Z
Answers.LastActivityDate: 2014-11-12T04:10:15.367Z
Answers.LastEditDate: 2014-11-12T04:10:15.367Z
Answers.UserDisplayName: Keith Mancuso
Body: <p>I'm starting with a clean install, empty database.  </p>
  
  <p>What would be the changes needed to this <a href="https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft">Nginx configuration</a> to serve craft from /articles/ instead of "/"?</p>
  
  <p>Any specific configurations that needs to be done to the Craft configs?</p>
  
  <p>I've tried many combinations that all ended in 404.</p>
  
  <p>Current layout:</p>
  
  <p>/srv/www/app/craft &lt;- "craft files"</p>
  
  <p>/srv/www/webroot &lt;- "public webroot"</p>
  
  <p>/srv/www/webroot/articles/ &lt;- "craft index.php here (with path set correctly to craft)".</p>
  
  <p>Thanks.</p>
  
Tags: <install><nginx>
Title: Serving Craft from a sub-directory on Nginx
ThreadText: # Serving Craft from a sub-directory on Nginx
  
  (Asked by: username_0 on 2014-11-12)
  
  I'm starting with a clean install, empty database.
  
  What would be the changes needed to this [Nginx configuration](https://craftcms.stackexchange.com/questions/961/what-is-the-recommended-nginx-configuration-for-craft) to serve craft from /articles/ instead of "/"?
  
  Any specific configurations that needs to be done to the Craft configs?
  
  I've tried many combinations that all ended in 404.
  
  Current layout:
  
  /srv/www/app/craft <- "craft files"
  
  /srv/www/webroot <- "public webroot"
  
  /srv/www/webroot/articles/ <- "craft index.php here (with path set correctly to craft)".
  
  Thanks.
  
  **Tags:** install, nginx
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-11-12. Score: 1 | Accepted answer
  
  If you want to just adjust the folder for the webroot set the root to
  
  /srv/www/webroot/articles/
  
  And in the index.php file make sure the path to the craft folder is
  
  '../../app/craft'
  
  UPDATE:
  
  If you instead want to leave the webroot as is and just have craft run from yourdomain.com/articles you would need to also update the index.php to make sure the craft path is set correct
  
  and in the nginx file add this
  
  ```
  location /articles/ {
    try_files $uri $uri/ @rewrites;  
  }
  
  location @rewrites {
     rewrite ^/articles/(.*)$ /articles/index.php?p=$1 last;
  }
  
  ```
  
  put that directly above this line, everything else can be the same
  
  ```
  location ~ \.php$ {
  
  ```
  
  > **Comments:**
  > **username_0**: Actually, the purpose of this sub-directory is that I have another app running from the webroot/, I can't point the server root to articles/. (index.php is set to point to ../../app/craft, and I do get 404 pages from Craft, but not much more.  
  > **username_1**: ok let me update my answer then  
  > **username_0**: username_1, I think it worked.  Initially I still got the 404, but calling /articles/admin/install fired the install process.   It ended with a Oops page, but nothing alarming in the craft.log, and all looks operational so far.  I will do more testing.  
  > **username_0**: Once inside the CP, I had to add /articles to the end of the site URL under the General Settings, is this normal or should that have been set automatically during install?  
  > **username_1**: Yea that's normal.  You can also just site the siteurl in the general.config but craft expects that to be the root of any craft urls it will build  
  
  ---
  
  