Learn about Centmin Mod LEMP Stack today
Become a Member

Nginx Can i use different ip for every vhost on Centminmod?

Discussion in 'Install & Upgrades or Pre-Install Questions' started by pamamolf, Jul 2, 2014.

  1. pamamolf

    pamamolf Well-Known Member

    2,659
    240
    63
    May 31, 2014
    Ratings:
    +422
    Local Time:
    2:08 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Hi

    Can i use different ip for every vhost on Centminmod?

    Thanks :)
     
  2. RoldanLT

    RoldanLT Well-Known Member

    3,868
    945
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,284
    Local Time:
    7:08 PM
    1.11
    10.2
    I think it's possible.
    You declare it's IP on each domain.conf
     
    • Like Like x 1
  3. pamamolf

    pamamolf Well-Known Member

    2,659
    240
    63
    May 31, 2014
    Ratings:
    +422
    Local Time:
    2:08 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Ok thanks RoldanLT :)

    I will wait for George to confirm it also just to be sure :)
     
  4. eva2000

    eva2000 Administrator Staff Member

    29,702
    6,707
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,009
    Local Time:
    9:08 PM
    Nginx 1.13.x
    MariaDB 5.5
    yes in each domain.com vhost file's listen directive http://nginx.org/en/docs/http/ngx_http_core_module.html#listen

    Code:
     server {
                listen ipaddress1  80;
    
      server_name yourdomainname.com www.yourdomainname.com;
    Code:
     server {
                listen ipaddress2  80;
    
      server_name yourdomainname.com www.yourdomainname.com;
    provided you have added additional ip addresses to your server i.e. http://www.cyberciti.biz/faq/linux-creating-or-adding-new-network-alias-to-a-network-card-nic/ or http://knowledgelayer.softlayer.com/procedure/assign-additional-ip-addresses-redhatcentos
     
    • Like Like x 5
  5. nVidian

    nVidian Member

    85
    8
    8
    Mar 16, 2015
    Ratings:
    +23
    Local Time:
    6:08 PM
    1.7.9
    5.5
    Hi, I'm confused. Here's at Drupal - Nginx Community they said:
     
    Last edited: Mar 16, 2015
  6. eva2000

    eva2000 Administrator Staff Member

    29,702
    6,707
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,009
    Local Time:
    9:08 PM
    Nginx 1.13.x
    MariaDB 5.5
  7. nVidian

    nVidian Member

    85
    8
    8
    Mar 16, 2015
    Ratings:
    +23
    Local Time:
    6:08 PM
    1.7.9
    5.5
    So if I want to add different IP to one of my site, do I must insert
    Code:
    listen new_IP;
    
    at its VHOST ??

    I already tried without that line , after edit ifcfg-eth0:0 to add new IP , I point DNS A record to the new IP. So it works without that line.
    But I dont know if its correct way, especially my intend is to use SSL (single domain) for that website. Could you clear this up ?
    Thanks eva2000.
     
  8. eva2000

    eva2000 Administrator Staff Member

    29,702
    6,707
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,009
    Local Time:
    9:08 PM
    Nginx 1.13.x
    MariaDB 5.5
    I personally set the separate ip in listen just serves to better identify which ip the domain is attached to if you have many ip addresses and many domains.

    You can imagine if you had 20 ips and 20 domains each with own ip, it would be a bit confusing knowing which domain goes to which ip at the local nginx vhost level.
     
  9. nVidian

    nVidian Member

    85
    8
    8
    Mar 16, 2015
    Ratings:
    +23
    Local Time:
    6:08 PM
    1.7.9
    5.5
    Yes, I even have more than 20 domains in that VPS :)
    So, I think I will follow your suggestion. Thanks eva2000.