Learn about Centmin Mod LEMP Stack today
Register Now

Sysadmin Additional IP And Nginx Setup

Discussion in 'System Administration' started by skringjer, Sep 27, 2019.

  1. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    need to remove reuseport from either one of these nginx vhost's listen directive animefever.to.ssl.conf or worldofpcgames.co.ssl.conf as it can only listed once per ip/port pairing - you most of had SECOND_IP in place at one time which allowed both nginx vhosts to have reuseport but reverting to single IP, only one can have reuseport
     
  2. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    Thanks alot, all issues fixed except for SSL on animefever Screenshot

    From this guide i ran these commands Generate Centmin Mod Nginx Vhost - CentminMod.com LEMP Nginx web stack for CentOS

    Code:
    mkdir -p /usr/local/nginx/conf/ssl/mydomain.com
    cd /usr/local/nginx/conf/ssl/mydomain.com
    openssl dhparam -out dhparam.pem 2048
    
    /usr/local/src/centminmod/addons/acmetool.sh acmeupdate
    
    /root/.acme.sh/acme.sh --force --issue --days 60 -d mydomain.com -d www.mydomain.com -w /home/nginx/domains/mydomain.com/public -k 2048 --useragent centminmod-centos-acmesh-webroot --log /root/centminlogs/acmetool.sh-debug-log-mydomain.com.log --log-level 2
    
    /root/.acme.sh/acme.sh --installcert -d mydomain.com -d www.mydomain.com --certpath /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com-acme.cer --keypath /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com-acme.key --capath /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com-acme.cer --reloadCmd /usr/bin/ngxreload --fullchainpath /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com-fullchain-acme.key
    
    And everything wen't fine, what could i have done wrong now?
     
    Last edited: Sep 30, 2019
  3. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    Issue fixed, i had to make changes in newdomain.com.crt.key.conf to add Letsencrypt files, thanks alot @eva2000 Everything working perfect.
     
  4. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Glad to hear :)
     
  5. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    @eva2000 Hi, how are you doing buddy? i hope everything is going well for you.

    Did you find a workaround for that ifconfig second IP thing that i was facing above, i have another site now for which i must use a secondary IP and again the same issue

    Code:
    domain.com is a top level domain
    your server IPv4 IP address: MY_NEWIP
    current DNS A record IPv4 address for domain.com is: MY_NEWIP
    all other commands shows the additional IP's except ifconfig, its a new CENTOS thing that i read on some forums.
     
  6. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    haven't looked at a workaround yet, but IIRC this message is only cosmetic, there's a prompt for you to continue or abort the nginx vhost site creation. If you know the new 2nd IP is properly setup on CentOS 7, then just answer yes to continue
    Code (Text):
    Abort this Nginx vhost domain setup to setup proper DNS A record(s) first? [y/n]:

    or you getting failed letsencrypt ssl certificate issuance/setup when you answer yes to continue ?
     
  7. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Last edited: Nov 19, 2019
  8. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    So today i gave it another try, and this time without giving any errors or notices, it just went through, everything perfect now on the second IP, i guess i need to give it some time or something.

    Eva is it possible to mount raid 0 array on / ? on an installed Centos
     
  9. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Good to hear

    as to raid 0 I'd never use it if you data is important to you as you risk data loss
     
  10. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    @eva2000 How are you doing buddy, So i have configured a second IP for one of my website,

    I have mulitple Ip's configured in my server, i have another website and i wanted to host website this website on a new IP

    The question is that in my presistant conf file, i have set my Second_IP to IP1

    For this new site i am using IP2

    How should i add this new IP in presistant conf file? separate it with a comma?

    eg:
    SECOND_IP=IP1,IP2 ???
     
  11. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Only one 2nd IP is supported in SECOND_IP unfortunately, for 3rd IP, you'd have to manually edit listen directive for the nginx vhost. You can use 2nd IP's nginx vhost config file as reference to see what needs changing
     
  12. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    Well i just added a second line of SECOND_IP=IP2 in presistent conf and it worked :) , separating IP with , dosent work.
     
  13. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Oh it works because you overrode the 1st SECOND_IP, so new nginx vhost used that. Guess you can do it that way, set SECOND_IP multiple times and comment out with hash # in front the ones you don't want to use for the next nginx vhost created.
     
  14. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    Yes loving Centmin, there is something else.

    Few times back i made some changes to my Virtual conf so that my server IP does not show default Centmin logo, i think i deleted the default index files and now it shows 403 Forbidden, can you tip me where could i find those files and put them back

    And also my PHPadmin shows this error

    [​IMG] There is a mismatch between HTTPS indicated on the server and client. This can lead to a non working phpMyAdmin or a security risk. Please fix your server configuration to indicate HTTPS properly.

    I think its due to that, or is it due to this new site that i created using Second_IP?

    other than Phpmyadmin everything works great.
     
  15. eva2000

    eva2000 Administrator Staff Member

    44,413
    10,142
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,690
    Local Time:
    4:39 PM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    see https://community.centminmod.com/th...tps-indicated-on-the-server-and-client.18930/

    fix is to update phpmyadmin.sh, run the uninstaller and re-install but only do that after you fix main hostname where IP access hits Centmin Mod default index page properly

    they're located at /usr/local/src/centminmod/htdocs/default/ for index.html and cmlogo.png which you place back in /usr/local/nginx/html
    Code (Text):
    cp /usr/local/src/centminmod/htdocs/default/index.html /usr/local/nginx/html/index.html
    cp /usr/local/src/centminmod/htdocs/default/cmlogo.png /usr/local/nginx/html/cmlogo.png
    chown -R nginx:nginx /usr/local/nginx/html/
    
     
  16. skringjer

    skringjer Member

    139
    15
    18
    Apr 21, 2019
    Ratings:
    +29
    Local Time:
    11:39 AM
    Fixed, thanks alot