Join the community today
Become a Member

Nginx Can't create staging site

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by runos, Feb 27, 2020.

  1. runos

    runos Member

    42
    13
    8
    Dec 17, 2019
    Ratings:
    +16
    Local Time:
    6:36 AM
    1.17.6
    10
    Hi! I tried creating a staging site by using a www2.demo.com sub domain but I get the following error. I already have demo.com running on the same server.


    Code:
    Feb 27 18:35:10 demo.demo systemd[1]: Unit nginx.service entered failed state.
    Feb 27 18:35:10 demo.demo systemd[1]: nginx.service failed.
    Feb 27 18:35:10 demo.demo systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
    Feb 27 18:35:10 demo.demo nginx[2142]: Starting nginx: nginx: [emerg] duplicate listen options for 0.0.0.0:443 in /usr/local/nginx/conf/conf.d/www2.demo.com.ssl.conf:11
    Feb 27 18:35:10 demo.demo nginx[2142]: [FAILED]
    Feb 27 18:35:10 demo.demo systemd[1]: nginx.service: control process exited, code=exited status=1
    Feb 27 18:35:10 demo.demo systemd[1]: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
    Pls advice.
     
  2. eva2000

    eva2000 Administrator Staff Member

    47,552
    10,791
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,776
    Local Time:
    8:36 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    does the listen directive for www2.demo.com.ssl.conf have reuseport directive ? if so make sure it's only added once for all ip / port 443 listen directives on ALL server nginx vhosts on server. When you create nginx vhosts via centmin.sh menu option 2, 22 or nv command, the routine checks for this and if reuseport already exists, new nginx vhosts would remove reuseport from created vhost listen directive.

    Now that auto routine check doesn't happen if you manually create an nginx vhost on server.

    you can also provide output for nginx config test check
    Code (Text):
    nginx -t
     
  3. runos

    runos Member

    42
    13
    8
    Dec 17, 2019
    Ratings:
    +16
    Local Time:
    6:36 AM
    1.17.6
    10
    I'm afraid I don't understand what's reuseport directive.
    Do let me know what info you need so I can post it here :)

    nginx -t
    Code:
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    
     
  4. runos

    runos Member

    42
    13
    8
    Dec 17, 2019
    Ratings:
    +16
    Local Time:
    6:36 AM
    1.17.6
    10
    Finally got it working. You're right. I had another site using the "listen 443 ssl http2 reuseport;" and I removed it.
    Now my new site is working.
    Thanks!
     
  5. eva2000

    eva2000 Administrator Staff Member

    47,552
    10,791
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +16,776
    Local Time:
    8:36 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Glad to hear :)