[GH-ISSUE #575] How to use Custom Nginx Configuration in Edit Proxy Host / Advanced #483

Closed
opened 2026-02-26 06:33:01 +03:00 by kerem · 4 comments
Owner

Originally created by @QuantiumDev on GitHub (Aug 24, 2020).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/575

Checklist

What is troubling you?

In Edit Proxy Host/Advanced - could someone please point me to some documentation for using this? I tried to paste an Nginx server block in there but no matter what I enter there, it causes the status to go OFFLINE until I delete the contents of that box.

I'm hoping there's a way to use this to set the root document path? If so, it would make it a lot easier to host multiple sites. (Or is there some other/better way to accomplish that?)

Originally created by @QuantiumDev on GitHub (Aug 24, 2020). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/575 **Checklist** - Please read the [setup instructions](https://nginxproxymanager.com/setup/) DONE - Please read the [FAQ](https://nginxproxymanager.com/faq/) DONE **What is troubling you?** In Edit Proxy Host/Advanced - could someone please point me to some documentation for using this? I tried to paste an Nginx server block in there but no matter what I enter there, it causes the status to go OFFLINE until I delete the contents of that box. I'm hoping there's a way to use this to set the root document path? If so, it would make it a lot easier to host multiple sites. (Or is there some other/better way to accomplish that?)
kerem 2026-02-26 06:33:01 +03:00
Author
Owner

@gregfr commented on GitHub (Aug 24, 2020):

Here is a simple working one:

location = / {  
    return 301 /login.html;
}

It will redirect to the login page (of the site) if the URL is just the site name.

<!-- gh-comment-id:679077198 --> @gregfr commented on GitHub (Aug 24, 2020): Here is a simple working one: ``` location = / { return 301 /login.html; } ``` It will redirect to the login page (of the site) if the URL is just the site name.
Author
Owner

@QuantiumDev commented on GitHub (Aug 26, 2020):

Thanks for the response but I don't really need to redirect. I'm trying to setup multiple proxy hosts so that each one will serve a different website. So I need to be able to specify the root document path. Any idea how to do that in the Advanced tab?

<!-- gh-comment-id:680401015 --> @QuantiumDev commented on GitHub (Aug 26, 2020): Thanks for the response but I don't really need to redirect. I'm trying to setup multiple proxy hosts so that each one will serve a different website. So I need to be able to specify the root document path. Any idea how to do that in the Advanced tab?
Author
Owner

@QuantiumDev commented on GitHub (Aug 26, 2020):

In case anyone else has this issue and finds their way here, this may help... Using gregfr’s suggestion, I set the document root in my main docker-compose file (the one that spins up my LEMP stack) to the parent directory for my websites. For my server, that looks like /media/datastore/websrv (then each of my hosted websites has its own directory below that - e.g. mywebsite1.com, mywebsite2.net, etc.) Then, in the advanced section for each proxy host, I use a modified version of gregfr’s code...

location = / {  
    return 301 /mywebsite1.com/index.php;
}

While this works, it has the following undesirable result: when I go to http://www.mywebsite1.com, it does get me to the correct home page for the site - but the URL shown in my browser’s address bar is: http://www.mywebsite1.com/mywebsite1.com/index.php
This works in general - if I try to go to another page on the site or display an image by typing in http://www.mywebsite1.com/img/banner.jpg it does display the image - but the url looks like http://www.mywebsite1.com/mywebsite1.com/img/banner.jpg
Functional, but kludgey.
If I renamed my website directories using abbreviations (like ws1, ws2, etc.) it might look a little better: http://www.mywebsite1.com/ws1/index.php but I’m sure there’s a better way of doing this and I’m hoping someone ( @jc21 ?) will post the proper solution for setting the document root via the advanced tab so everything just works without the wonky url.

<!-- gh-comment-id:680916938 --> @QuantiumDev commented on GitHub (Aug 26, 2020): In case anyone else has this issue and finds their way here, this may help... Using gregfr’s suggestion, I set the document root in my main docker-compose file (the one that spins up my LEMP stack) to the _parent_ directory for my websites. For my server, that looks like /media/datastore/websrv (then each of my hosted websites has its own directory below that - e.g. mywebsite1.com, mywebsite2.net, etc.) Then, in the advanced section for each proxy host, I use a modified version of gregfr’s code... ``` location = / { return 301 /mywebsite1.com/index.php; } ``` While this works, it has the following undesirable result: when I go to http://www.mywebsite1.com, it does get me to the correct home page for the site - but the URL shown in my browser’s address bar is: http://www.mywebsite1.com/mywebsite1.com/index.php This works in general - if I try to go to another page on the site or display an image by typing in http://www.mywebsite1.com/img/banner.jpg it _does_ display the image - but the url looks like http://www.mywebsite1.com/mywebsite1.com/img/banner.jpg Functional, but kludgey. If I renamed my website directories using abbreviations (like ws1, ws2, etc.) it might look a little better: http://www.mywebsite1.com/ws1/index.php but I’m sure there’s a better way of doing this and I’m hoping someone ( @jc21 ?) will post the proper solution for setting the document root via the advanced tab so everything just works without the wonky url.
Author
Owner

@chaptergy commented on GitHub (May 12, 2021):

The content of the advanced tab input will be inserted within the server configuration block of your host. The advanced data of your location will be inserted inside the location block.

<!-- gh-comment-id:839948040 --> @chaptergy commented on GitHub (May 12, 2021): The content of the advanced tab input will be inserted within the server configuration block of your host. The advanced data of your location will be inserted inside the location block.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#483
No description provided.