Submitted by vishnunuk on Fri, 02/19/2016 - 17:34
I am configuring a new Debian 8 Server with GPL Webmin/Virtualmin
My VPS is iPv6 enabled, when i adding new domain via Virtualmin it adds duplicate listen (iPv6). Nginx stops working with the following error message.
> Applying Nginx configuration .. .. configuration is invalid : nginx:
> [emerg] duplicate listen options for
> [2600:3c00::f03c:91ff:fe08:b171]:80 in
> /etc/nginx/sites-enabled/testingg.com:4 nginx: configuration file
> /etc/nginx/nginx.conf test failed.
I found that manually removing Duplicated iPv6 will help, and Nginx will start normally. The problem is for every new domain i need to manually delete duplicated ipv6.
There is any way automatically manage this?
I have another server running older version of Nginx and webmin/Virtualmin that server has no problems.
More info
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
I have try but no luck
listen 80;
listen [::]:80 ipv6only=on default_server;
After adding a new domain via Virtualmin
server {
server_name nexnw.net www.nexnw.net;
listen 104.236.28.243;
listen [2604:A880:0800:0010:0000:0000:01CA:0001] default ipv6only=on;
root /home/nexnw/public_html;
index index.html index.htm index.php;
access_log /var/log/virtualmin/nexnw.net_access_log;
error_log /var/log/virtualmin/nexnw.net_error_log;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME /home/nexnw/public_html$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/nexnw/public_html;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/php-nginx/14558692433443.sock/socket;
}
listen 104.236.28.243:443 default ssl;
ssl_certificate /home/nexnw/ssl.cert;
ssl_certificate_key /home/nexnw/ssl.key;
}
Nginx version 1.6.2 & Webmin 5.0
root@debian-2gb-nyc3-01:~# systemctl status -l nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Fri 2016-02-19 03:14:54 EST; 5min ago
Process: 3788 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
Process: 4101 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 4099 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 796 (code=exited, status=0/SUCCESS)
Feb 19 03:14:51 debian-2gb-nyc3-01 nginx[4101]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 19 03:14:52 debian-2gb-nyc3-01 nginx[4101]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 19 03:14:52 debian-2gb-nyc3-01 nginx[4101]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 19 03:14:53 debian-2gb-nyc3-01 nginx[4101]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 19 03:14:53 debian-2gb-nyc3-01 nginx[4101]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
Feb 19 03:14:54 debian-2gb-nyc3-01 nginx[4101]: nginx: [emerg] still could not bind()
Feb 19 03:14:54 debian-2gb-nyc3-01 systemd[1]: nginx.service: control process exited, code=exited status=1
Feb 19 03:14:54 debian-2gb-nyc3-01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Feb 19 03:14:54 debian-2gb-nyc3-01 systemd[1]: Unit nginx.service entered failed state.
root@debian-2gb-nyc3-01:~#
iPv6 & iPv4 trying to use 80 so Nginx Stopped working!
Files:
Status:
Active
Comments
Submitted by vishnunuk on Fri, 02/19/2016 - 17:43 Comment #1
Submitted by vishnunuk on Sat, 02/20/2016 - 01:54 Comment #2
I'm using ii webmin-virtualmin-nginx 1.8 all Webmin module for 'Nginx Webserver'
I already changed the code for /usr/share/webmin/virtualmin-nginx/virtual_feature.pl if ($d->{'ip6'}) { push(@{$server->{'members'}}, { 'name' => 'listen', 'words' => [ '['.$d->{'ip6'}.']'.$portstr, 'default' , 'ipv6only=on' ] }); } to be if ($d->{'ip6'}) { push(@{$server->{'members'}}, { 'name' => 'listen', 'words' => [ '['.$d->{'ip6'}.']'.$portstr, ] }); }
and it works great please let me know if there's something wrong in my configuration thank you
Submitted by JamieCameron on Sun, 02/21/2016 - 17:53 Comment #3
The 2.0 release of the Nginx plugin will fix this (and it should be out real soon now).