0

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
New contributor
tommyk is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • The error suggest that there are more server configurations on this port, maybe included in your config (check the various include directives you have) Dec 2 at 16:11
  • You could do a grep -r "listen 443" /etc/nginx/
    – Turdie
    Dec 2 at 17:03
  • Use nginx -T (uppercase T) to view the entire configuration across all included files. You probably need to check for consistent options across all of the listen 443 statements. Dec 2 at 17:31

0

You must log in to answer this question.

Browse other questions tagged .