• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Question nginx reverse proxy directive for "location /" for specific domain only

davewood

New Pleskian
I want to proxy all requests on a specific domain to another server. (Plesk Obsidian)

i have a few sites configured

portal.example.com
foo.example.com
bar.example.com

all requests to portal.example.com should be proxied to portal.internalserver.com


Hosting Settings
hosting type: website

Apache & nginx Settings
nginx proxy mode: deactivated
Additional nginx directives:
Code:
location / {
    proxy_pass       http://portal.internalserver.com:8000;
    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;
}

this directive doesnt matche because its included after the default templates location directive.

custom templates seem to be the answer but I cannot figure out how to restrict a custom template to a specific subdomain.

Here are a few links that I came across while looking for an answer:
 
I'm also looking on a way to resolve this.

I'm hosting additional server, with dockered NextCloud instances and since my public IP addresses are limited I cannot assign one to to NextCloud machine to manage nginx vhosts there, and use default 443 port for hosting.
I've tried to proxy pass requests from subdomains to my NextCloud instance but to no avail.
Using Plesk would be not only technically easier but way more convenient - Plesk could manage LetsEncrypt certificartes, domains, and nginx logs...

So far I was able to proxy additional locations (not subdomains), like /nextcloud - as this does not duplicate location "/" in the nginx additional directives field.
 
Back
Top