• 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.

Resolved Set Nginx reverse proxy configuration permanentely

Lars Lehmann

New Pleskian
We use nginx as a reverse proxy for directing the traffic of a subdomain to a specific port (11111 for example).

We can set this up in the nginx.conf file in the subdomains system config.

But always, when the subdomain is updated over plesk (when applying a new ssl certficate for instance), this conf file is overwritten and our custom configuration is lost. After this, our webapp is not accessible anymore and we need to change the file again.

My Question:
is it possible to make the following configuration or a similar permanent? (we also tried the Additional nginx directives, which doesn't work).

```
location / {
proxy_pass https://93.90.178.92:11111;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Accel-Internal /internal-nginx-static-location;
access_log off;
}
```
 
Thank you for your answer!

When I set a custom template, doesn't affect that all other (sub-) domains on our server as well?

And how should the template look like?
 
All new domains will be created based on this custom template.
 
But this is not what I wanted. I just want to reconfigure the 'location "/"' setting for some speciffic subdomains. Not for all or for all new upcoming ones.

Is there no other way?
 
Okay,
now I got a glimpse of a solution.

I used the vhost_nginx.conf configuration file an inserted the following:

location ~ / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_pass https://{{DOMAIN}}.de:{{PORT}};
}


It overwrites the configuration of Plesk.

This works perfect, but only if I manually remove the following from the nginx.conf file:

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


I also cannot overwrite it like:

location ~ /$ {
proxy_pass https://{{DOMAIN}}.de:{{PORT}};
}



So, how can I permanentely remove the location ~ /$ {} from the nginx.conf or just overwrite it with my proxy?

Thank you!!!
 
I have the solution.
You can go into the "Apache and Nginx Settinngs" in a subdomain panel.

In the section of "Index files", set the option to "Enter custom value" and then replace the value of the textbox below with a simple space character " ".
If you don't put this space into the box, the option is not saved. But if you do so, then the nginnx is configured properly.

Very hacky, but it's working though.
 
Back
Top