• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Plesk nginx conf files, seem to bring to an error notification when running 'nginx -s reload'

Ehud

Basic Pleskian
Server operating system version
nginx version: nginx/1.24.0 Server version: Apache/2.4.57 (Ubuntu) Server built: 2023-04-08T12:56:02
Plesk version and microupdate number
Product version: Plesk Obsidian 18.0.53.2 OS version: Ubuntu 22.04 x86_64 Build date: 2023/06/19 12:00
Hi,

The Plesl nginx domain file configuration, includes two 'server' blocks to liste for the same IP, where the first listen only server_name with a 'www' prefix, and reroutes with a '301' code into the second. To me, that did make sense.

However, nowadays, when running the CLI:

NGINX:
nginx -s reload

The error notification at the bottom of this post appears.

Any suggestion of placing those two 'listen' together within the same 'server' block, where the order of lines matters? Any other solution?


#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
proxy_cache_path /var/cache/nginx/example.com_proxy levels=1:2 keys_zone=example.com_proxy:5m max_size=134217728;

Code:
server {
        listen <server_ip>:443 ssl;


        ssl_certificate             /opt/psa/var/certificates/<certificate>;
        ssl_certificate_key         /opt/psa/var/certificates/<certificate>;


        server_name www.example.com;


        location / {
                return 301 https://example.com$request_uri;
        }


}


server {
        listen <server_ip>:443 ssl http2;


        server_name example.com;
        server_name ipv4.example.com;


        ssl_certificate             /opt/psa/var/certificates/<certificate>;
        ssl_certificate_key         /opt/psa/var/certificates/<certificate>;
        
        ...
        
}



Code:
nginx: [warn] protocol options redefined for <server_ip>:443 in /etc/nginx/plesk.conf.d/vhosts/example.com.conf:22
 
Nginx has changed something in a recent update that now requires specific instructions in configuration files for some cases. If these are missing, a warning is issued, but the functionality is not affected. Plesk is aware of the issue and will update their software accordingly.
 
Hi Peter Debik,

Thanks a lot!

Can you, by chance, suggest the manual walkaround for the above simple conf file example, possibly being moving the first 'server' block content into the second one, and keeping the order of commands?
 
Back
Top