Welcome to Centmin Mod Community
Become a Member

Install Let'sencrypt Error: domain.tld is already setup for server main hostname

Discussion in 'Install & Upgrades or Pre-Install Questions' started by siliwangi, May 22, 2020.

  1. siliwangi

    siliwangi Premium Member Premium Member

    2
    0
    1
    May 22, 2020
    Ratings:
    +0
    Local Time:
    10:18 PM
    Nginx 1.17
    MariaDB 10.3
    • CentOS Version: CentOS 7 64 Bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: 1.17.10
    • PHP Version Installed: 7.3.18
    • MariaDB MySQL Version Installed: 10.3
    • When was last time updated Centmin Mod code base ? : now
    • Persistent Config:
      Code:
      LETSENCRYPT_DETECT='y'
      MARCH_TARGETNATIVE='y'
      
    This is a fresh install in a Linode, without any centminmod addons, my hostname and /etc/hosts is already filled with domain.tld, somehow i cannot passed creating the ssl vhost with let'sencrypt supports.
    Code:
    Do you want to continue with Nginx vhost site creation ? [y/n] y
    
    Enter vhost domain name to add (without www. prefix): domain.tld
    
     Error: domain.tld is already setup for server main hostname
     at /usr/local/nginx/conf/conf.d/virtual.conf
     It is important that main server hostname be setup correctly
    
     As per Getting Started Guide Step 1 centminmod.com/getstarted.html
     The server main hostname needs to be unique. So please setup
     the main server name vhost properly first as per Step 1 of guide.
    
     Aborting nginx vhost creation...
    
    While checking the /usr/local/nginx/conf/conf.d/virtual.conf, the server_name inside that virtual.conf already contained domain.tld. How to proceed with these?
     
  2. eva2000

    eva2000 Administrator Staff Member

    44,186
    10,074
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,572
    Local Time:
    1:18 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    What is your intention to have a full web site on domain.tld ? Is so you don't want main hostname to be the same domain name.

    When you install Centmin Mod it's setup a main hostname nginx vhost host for server which is where Nginx default install index page is shown. Accessing server via IP address will show that page and it's correct and should be left as is as the main hostname site is also used for statistics pages outlined here. When you create a new Nginx vhost site via centmin.sh menu option 2, 22 or nv commands, you have a separate Nginx vhost directory structure. The differences are outlined on official Config file page and at Getting Started Guide step 1 and bottom of that page here.
    What does your /usr/local/nginx/conf/conf.d/virtual.conf and /usr/local/nginx/conf/conf.d/yourdomain.com.conf contents look like ? Make sure virtual.conf main hostname's server_name isn't same as any added nginx vhost site's domain name as per Getting Started Guide step 1, the main hostname needs to be unique.

    You can check via recursive grep filter of your domain name in vhost directory at /usr/local/nginx/conf/conf.d
    Code (Text):
    grep -rnw 'yourdomain.com' /usr/local/nginx/conf/conf.d
    

    Also check DNS is correct use dig to check DNS for domain
    Code (Text):
    dig +short A @8.8.8.8 yourdomain.com
    dig +short A @8.8.8.8 www.yourdomain.com
    dig +short A @8.8.8.8 hostname.yourdomain.com
    

    check HTTP headers via curl for both HTTP (and HTTPS if you have HTTPS/SSL)
    Code (Text):
    curl -I http://yourdomain.com
    curl -I http://www.yourdomain.com
    curl -I https://yourdomain.com
    curl -I https://www.yourdomain.com
    curl -I http://hostname.yourdomain.com