[SOLVED] nginx.service failed

Jul 31, 2019
24
4
23
53
Hi

After this weekend update I'm now getting errors on the nginx service, any ideas anyone?

/Peter

-----------
Code:
root@pmg:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up nginx-full (1.14.2-2+deb10u4) ...
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2021-06-01 16:54:01 CEST; 23ms ago
     Docs: man:nginx(8)
  Process: 56794 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Jun 01 16:54:01 pmg systemd[1]: Starting A high performance web server and a reverse proxy server...
Jun 01 16:54:01 pmg nginx[56794]: nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/pmg-quarantine.conf:2
Jun 01 16:54:01 pmg nginx[56794]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 01 16:54:01 pmg systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 01 16:54:01 pmg systemd[1]: nginx.service: Failed with result 'exit-code'.
Jun 01 16:54:01 pmg systemd[1]: Failed to start A high performance web server and a reverse proxy server.
dpkg: error processing package nginx-full (--configure):
 installed nginx-full package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
 nginx depends on nginx-full (<< 1.14.2-2+deb10u4.1~) | nginx-light (<< 1.14.2-2+deb10u4.1~) | nginx-extras (<< 1.14.2-2+deb10u4.1~); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.
 nginx depends on nginx-full (>= 1.14.2-2+deb10u4) | nginx-light (>= 1.14.2-2+deb10u4) | nginx-extras (>= 1.14.2-2+deb10u4); however:
  Package nginx-full is not configured yet.
  Package nginx-light is not installed.
  Package nginx-extras is not installed.

dpkg: error processing package nginx (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 nginx-full
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@pmg:~#
 
Jun 01 16:54:01 pmg nginx[56794]: nginx: [emerg] a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/pmg-quarantine.conf:2
This seems to be the offending line.

Running grep -R default_server /etc/nginx may help you to find where the overlapping default server configuration is coming from.
Otherwise, just check if there are any unintended configurations found in this directory.
 
  • Like
Reactions: Stoiko Ivanov
This is what /etc/nginx/sites-enabled/pmg-quarantine.conf looks like:

Code:
server {
    listen 80 default_server;
    rewrite ^(.*) https://$host$1 permanent;
}
 
server {
    listen 443;
    server_name _;
    ssl on;
    ssl_certificate /etc/pmg/pmg-api.pem;
    ssl_certificate_key /etc/pmg/pmg-api.pem;
    proxy_redirect off;

    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header PVEClientIP $remote_addr;
    proxy_buffering off;
    client_max_body_size 0;
    proxy_connect_timeout  3600s;
    proxy_read_timeout  3600s;
    proxy_send_timeout  3600s;
    send_timeout  3600s;
    # proxy requests for static components
    location ~ /proxmoxlib.js$|/favicon.ico$|/pve2/|/fontawesome/|/framework7/|/pwt/css/ {
        proxy_pass https://localhost:8006;
    }
    location /quarantine {
        proxy_pass https://localhost:8006;
    }

    location /api2 {
        location ~ /api2/(extjs|json|htmlmail)/(access/ticket$|version$) {
            proxy_pass https://localhost:8006;
        }
        location ~ /api2/(extjs|json|htmlmail)/nodes/.+/subscription$ {
            proxy_pass https://localhost:8006;
        }
        location ~ /api2/(extjs|json|htmlmail)/quarantine {
            proxy_pass https://localhost:8006;
        }
        return 403;
    }

    location / {
        return 403;
    }
}

and this is the output root@pmg:~# grep -R default_server /etc/nginx
Code:
/etc/nginx/sites-available/pmg-quarantine.conf:    listen 80 default_server;
/etc/nginx/sites-available/default:     listen 80 default_server;
/etc/nginx/sites-available/default:     listen [::]:80 default_server;
/etc/nginx/sites-available/default:     # listen 443 ssl default_server;
/etc/nginx/sites-available/default:     # listen [::]:443 ssl default_server;
/etc/nginx/sites-enabled/pmg-quarantine.conf:    listen 80 default_server;
/etc/nginx/sites-enabled/default:       listen 80 default_server;
/etc/nginx/sites-enabled/default:       listen [::]:80 default_server;
/etc/nginx/sites-enabled/default:       # listen 443 ssl default_server;
/etc/nginx/sites-enabled/default:       # listen [::]:443 ssl default_server;
 
If you remove default_server from /etc/nginx/sites-enabled/pmg-quarantine.conf, this should fix the issue.
You can also remove the default configuration from sites-enabled (or remove default_server from the files), should you want pmg-quarantine to be the default. In any case, there can only be one default_server.
 
i have the same issue but my error is dlopen() . this happened after updating from 6.4 to 7.1-8

nginx: [emerg] dlopen() "/usr/share/nginx/modules/ngx_stream_geoip_module.so" failed (/usr/share/nginx/modules/ngx_stream_geoip_module.so: undefined symbol: ngx_stream_add_variable) in /etc/nginx/modules-enabled/70-mod-stream-geoip.conf:1
nginx: configuration file /etc/nginx/nginx.conf test failed
 
Last edited:
Same issue is happening to me

nginx: [emerg] dlopen() "/usr/share/nginx/modules/ngx_stream_geoip_module.so" failed (/usr/share/nginx/modules/ngx_stream_geoip_module.so: undefined symbol: ngx_stream_add_variable) in /etc/nginx/modules-enabled/70-mod-stream-geoip.conf:1

nginx: configuration file /etc/nginx/nginx.conf test failed
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!