NGINX Multi Site * SSL Subdomains: Configuration file error : [emerg] duplicate listen options for 0.0.0.0:443 — help!

[ad_1]

Hello,

I’m needing help, currently in process of installing SSL on an NGINX, Ubuntu 22.04 Vultr server. I have two existing domains on the server. Setting up a wildcard SSL for an WordPress Multi Site (Subdomain base) and am getting stuck at setting up my website’s configuration file within the /sites-available/ folder.

I’m not certain how to troubleshoot this.

I installed the certbot via

sudo certbot certonly –manual –preferred-challenges dns –server https://acme-v02.api.letsencrypt.org/directory -d ‘*.gethisyes.com’ -d gethisyes.com

I added the TXT record challenge to my DNS. All good there.

But now trying to set up the configuration file, I’m getting a “duplicate listening” option error. I’m not certain how to set up the configuration file for a wildcard ssl for a wordpress multi site domain.

Here is my current /sites-available/site.com.conf configuration file

map $http_host $blogid {
default -999;
}

server {
listen 80;
server_name example.com *.example.com;
return 301 http://example.com$request_uri;
}

server {
listen 443 http2 ssl backlog=4096;
server_name example.com *.example.com;
root /var/www/example.com/public_html;
index index.php;

location / {
try_files $uri $uri/ /index.php$is_args$args;

}

location ~ ^/files/(.*)$ {
try_files /wp-content/blogs.dir/$blogid/$uri /wp-includes/ms-files.php?file=$1 ;
access_log off; log_not_found off; expires max;
}

#WPMU x-sendfile to avoid php readfile()
location ^~ /blogs.dir {
internal;
alias /var/www/example.com/html/wp-content/blogs.dir;
access_log off; log_not_found off; expires max;

}
include /etc/nginx/ssl/ssl_example.com.conf;
include /etc/nginx/ssl/ssl_all_examples.conf;

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
include /etc/nginx/includes/fastcgi_optimize.conf;

}

include /etc/nginx/includes/browser_caching.conf;
access_log /var/log/nginx/access_example.com.log combined buffer=256k flush=60m;
error_log /var/log/nginx/error_example.com.log;

}

When I test the nginx configuration files I get this error

nginx: [emerg] duplicate listen options for 0.0.0.0:443 in /etc/nginx/sites-enabled/gethisyes.com.conf:13
nginx: configuration file /etc/nginx/nginx.conf test failed

Anyone have any ideas?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer