Learn about Centmin Mod LEMP Stack 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

    2,978
    275
    83
    May 31, 2014
    Ratings:
    +485
    Local Time:
    1:22 PM
    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. RoldanLT

    RoldanLT Well-Known Member

    4,069
    983
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,367
    Local Time:
    7:22 PM
    1.11
    10.2
    It should work fine.
     
    • Like Like x 1
  3. pamamolf

    pamamolf Well-Known Member

    2,978
    275
    83
    May 31, 2014
    Ratings:
    +485
    Local Time:
    1:22 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Thanks :)

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

    eva2000 Administrator Staff Member

    32,261
    7,166
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,893
    Local Time:
    9:22 PM
    Nginx 1.13.x
    MariaDB 5.5
    should work but only way is test and see !
     
  5. Matt

    Matt Moderator Staff Member

    736
    335
    63
    May 25, 2014
    Sheffield, UK
    Ratings:
    +488
    Local Time:
    11:22 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