• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Question How to overwrite existing nginxs configurations?

L. Hagen

Basic Pleskian
Server operating system version
Ubuntu 22.04
Plesk version and microupdate number
Obsidian v18
Hi,

I'm trying to setup my private docker registry with the public port 5000 on my server running Plesk. In the internet I found several tutorials. They all need to extend the nginx configuration line this:
server {
listen 80;
server_name SERVER_URL;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

location / {
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}

proxy_pass http://localhost:5000;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}
}

So far so good. I stepped now into the Additional nginx directives and tried to extend it like this:
location / {
if ($http_user_agent ~ "^(docker\/1\.(3|4|5(?!\.[0-9]-dev))|Go ).*$" ) {
return 404;
}

proxy_pass http://localhost:5000;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}

But I get always an error
Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/SERVER_URL/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

The nginx code itself seems to be ok, but what can I do to get to to work? And on a standalone system without Plesk it works too. So I expect that it has any conflicts with the Plesk configuration, but of course I don't want to hard-code any changes into configuration files outside the Plesk UI.

I appreciate any help.

Thx and best regards,
Lars
 
Invalid nginx configuration: nginx: [emerg] duplicate location "/" in /var/www/vhosts/system/SERVER_URL/conf/vhost_nginx.conf:1 nginx: configuration file /etc/nginx/nginx.conf test failed

This usually happens when nginx Proxy mode is still enabled for a domain. Disable proxy mode and click the Apply button first and then add the additional nginx directives.
 
Back
Top