Discover Centmin Mod today
Register Now

Nginx Subdomain pointing to a folder inside the main domain?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Aug 17, 2017.

  1. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    11:58 AM
    Nginx-1.29.x
    MariaDB 10.6.x
    Hello :)

    I want to ask if it is possible to have one main domain for example:

    Code:
    www.domainmain.com
    pointing to:

    Code:
    root /home/nginx/domains/domainmain.com/public;
    and then create a subdomain for example:

    Code:
    sub.domainmain.com
    and point it to a folder inside the main domain like:

    Code:
    root /home/nginx/domains/domainmain.com/public/folderforsub;
    Is that ok?

    I know that is not the best way to do that for a subdomain but i am wondering if it will work or not?

    Thank you

     
  2. rdan

    rdan Well-Known Member

    5,452
    1,418
    113
    May 25, 2014
    Ratings:
    +2,212
    Local Time:
    4:58 PM
    Mainline
    10.2
    It should work fine.
     
  3. pamamolf

    pamamolf Well-Known Member

    4,126
    429
    83
    May 31, 2014
    Ratings:
    +841
    Local Time:
    11:58 AM
    Nginx-1.29.x
    MariaDB 10.6.x
    Thanks :)

    I will wait for George to confirm also :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    59,341
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    6:58 PM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    should work but only way is test and see !
     
  5. Matt

    Matt Well-Known Member

    932
    415
    63
    May 25, 2014
    Rotherham, UK
    Ratings:
    +671
    Local Time:
    9:58 AM
    1.5.15
    MariaDB 10.2
    Yes, it will work. I've worked on servers that had subdomains configured like this.