Discover Centmin Mod today
Register Now

Nginx PHP-FPM How To Change An Existing Domain.

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by skringjer, Sep 25, 2019.

  1. skringjer

    skringjer Premium Member Premium Member

    169
    19
    18
    Apr 21, 2019
    Ratings:
    +34
    Local Time:
    8:22 PM
    Please fill in any relevant information that applies to you:
    • CentOS Version: CentOS 7
    • Centmin Mod Version Installed: i.e. 123.08stable or 123.09beta01
    • Nginx Version Installed: 1.17.0
    • PHP Version Installed: 7.3.5
    • MariaDB MySQL Version Installed: 10.3.15
    • When was last time updated Centmin Mod code base ? : Regular Automatic Updates
    • Persistent Config:
      Code (Text):
      ETSENCRYPT_DETECT='y'
      

    Hi everyone and @eva2000 , so i have a site up and running on Centmin, i want to change just the domain and have all the configs, and site data the same, is this possible?

    I don't want to redo everything, because i had to change my domain due to some issues.

     
  2. eva2000

    eva2000 Administrator Staff Member

    47,474
    10,760
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,718
    Local Time:
    1:22 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
  3. skringjer

    skringjer Premium Member Premium Member

    169
    19
    18
    Apr 21, 2019
    Ratings:
    +34
    Local Time:
    8:22 PM
    Thank you for replying @eva2000 , its actually another server i will let you know about the Letsencrypt issue in the relevant thread.

    I used your above guide, and when i restart nginx i get this error
    Code:
    nginx.service failed.
    systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
    nginx[16396]: Starting nginx: nginx: [emerg] cannot load certificate "/usr/local/nginx/conf/ssl/newdomain.com
    [FAILED]
    nginx.service: control process exited, code=exited status=1
    Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
    Unit nginx.service entered failed state.
    nginx.service failed.
    Hint: Some lines were ellipsized, use -l to show in full.
    And nginx -t gives

    Code:
    ginx: [emerg] cannot load certificate "/usr/local/nginx/conf/ssl/newdomain.com/newdomain.com-acme.cer": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/usr/local/nginx/conf/ssl/newdomain.com/newdomain.com-acme.cer','r') error:2006D080:BIO routines:BIO_new_file:no such file)
    And here is my usr/local/nginx/conf/ssl/newdomain.com/ directory

    Screenshot highlighted with red is the old domain and with blue is the new one, do i need to create an SSL certificate? i am guessing that.
     
  4. skringjer

    skringjer Premium Member Premium Member

    169
    19
    18
    Apr 21, 2019
    Ratings:
    +34
    Local Time:
    8:22 PM
    Okay issued fixed, i renamed the ssl conf file of the new domain, added the non-ssl file back and restarted nginx, re-issued Letsencrypt and then again re-named the ssl conf file of the new domain back to original, restarted nginx and everything is working.


    Thanks alot eva, i just cant believe that there is guide for almost everything and you really are a one man army.
     
  5. eva2000

    eva2000 Administrator Staff Member

    47,474
    10,760
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,718
    Local Time:
    1:22 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    interesting shouldn't have needed to do that step though

    well try to do the guide one time - future times will be just pointing folks to the guide :)