Join the community today
Become a Member

Nginx Redirect subdomain

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Jul 5, 2019.

  1. pamamolf

    pamamolf Premium Member Premium Member

    3,353
    318
    83
    May 31, 2014
    Ratings:
    +593
    Local Time:
    10:10 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Hello

    If i have a subdomain like sub.mydomain.com can i redirect to look at browser like:
    Code:
    https://www.domain.com/sub/
    ?

    Thank you
     
  2. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:10 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  3. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:10 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    oh re-read that you want the url in browser masked and not just redirected ?

    then looking at setting up a reverse proxy more likely

    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such.

    However, Centmin Mod users are free to help each other out and ask questions or give answers on this community forum. My hopes are that this community forum evolves so that more veteran long time Centmin Mod users help new Centmin Mod users out :)

    Centmin Mod's Nginx has all the nginx modules it requires for you to configure nginx reverse proxy, nginx based load balancing and proxy caching (with exception of the shared file system you'd need i.e. NFS, GlusterFS and any mysql database cluster/replication). You just have to configure it yourself :)

    For nginx reverse proxy & load balancing read the documentation, tutorial and guides below
     
    style="display:inline-block;min-width:400px;max-width:970px;width:95%;height:90px" data-ad-client="ca-pub-6669518204467592" data-ad-slot="4024536743" data-ad-format="auto">
  4. pamamolf

    pamamolf Premium Member Premium Member

    3,353
    318
    83
    May 31, 2014
    Ratings:
    +593
    Local Time:
    10:10 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Ok i did it by using:
    Code:
    rewrite ^/(.*)$ https://mydomain.com/subhere/$1 permanent;
    A full redirect or just masked at the url doesn't matter....

    Thank you
     
    • Informative Informative x 1
  5. eva2000

    eva2000 Administrator Staff Member

    40,634
    9,023
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,891
    Local Time:
    5:10 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    yeah much easier if you don't need to mask the url :)