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:
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;
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