• 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 Nginx - configure service on domain root

davorg

Basic Pleskian
I'm having trouble configuring a web service to run on the root of a domain on Plesk server.

I have a service running on port 2222.

I have the following in the "Additional nginx directives" section on the "Apache and nginx settings" page:

location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:2222/;
}

Just adding this seems to conflict with the main nginx config (and my service throws a 404 error). In order to get it working correctly, I need to comment out parts of the main config file

# location ~ /$ {
# index "index.html" "index.cgi" "index.pl" "index.php" "index.xhtml" "index.htm" "index.shtml";
#}


This works fine
until Plesk updates automatically and overwrites nginx.conf. At which point the site breaks again until I notice and comment the lines out again.

What's the approach I should be using to do this? Plesk must surely support having a domain that is completely powered by a web service?

Thanks,

Dave...
 
Don't create the domain in Plesk but create a complete config-file in /etc/nginx/conf.d/
Personally I don't think such a domain belongs in Plesk as it's not going to Apache.

If you still want to create the domain in Plesk you can..
You do have to start the name of the config-file with a letter lower than z to force it to be executed before zz010_psa_nginx.conf
That's the file that refers to all the Plesk websites.

If you're not hosting anything in Apache for that domain I would recommend turning off web-hosting in Plesk for that domain.
 
Last edited:
I have Apache Solr running on port 8983 of the domain root (i.e. http://domain:8983/solr/#/), and all I want nginx for is to reverse proxy so I can set up user authentication ONLY for the solr admin console. (I can't do basic authentication directly in the solr files because that then prevents the web applications that use it from accessing it.) From everything I've read online, the reverse proxy would be to localhost. Is this what the above is basically trying to do?
 
Just adding this seems to conflict with the main nginx config (and my service throws a 404 error). In order to get it working correctly, I need to comment out parts of the main config file

That's not necessarily true... try doing it in 3 steps
  1. Open "Apache & nginx settings", deselect "Proxy mode", click "OK"
  2. Open "Apache & nginx settings" again, put your "location /" config in "Additional nginx directives", click OK again
  3. Be happy!
 

I never did get around to this months ago... now looking into it again. So I need to go to the Plesk panel and somewhere add the following nginx directives?:

location ~ / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8983;
proxy_http_version 1.1;
proxy_pass_request_headers on;
proxy_store off;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}

Then obviously create the password. I didn't really understand the closing off of ports bit.
 
Back
Top