Get the most out of your Centmin Mod LEMP stack
Become a Member

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

    3,113
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    5:55 AM
    Nginx-1.13.x
    MariaDB 10.1.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 Premium Member Premium Member

    4,255
    1,034
    113
    May 25, 2014
    Ratings:
    +1,486
    Local Time:
    10:55 AM
    Mainline
    10.2
    It should work fine.
     
    • Like Like x 1
  3. pamamolf

    pamamolf Well-Known Member

    3,113
    295
    83
    May 31, 2014
    Ratings:
    +530
    Local Time:
    5:55 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Thanks :)

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

    eva2000 Administrator Staff Member

    36,050
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    12:55 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    should work but only way is test and see !
     
  5. Matt

    Matt Moderator Staff Member

    765
    343
    63
    May 25, 2014
    Sheffield, UK
    Ratings:
    +512
    Local Time:
    3:55 AM
    1.7.1
    MariaDB 10
    Yes, it will work. I've worked on servers that had subdomains configured like this.
     
    • Agree Agree x 1
    • Informative Informative x 1
..