[GH-ISSUE #1913] How to add a static website for root location? #1393

Closed
opened 2026-02-26 07:30:48 +03:00 by kerem · 6 comments
Owner

Originally created by @jearton on GitHub (Mar 5, 2022).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1913

Is your feature request related to a problem? Please describe.

No.

Describe the solution you'd like

  1. Add root location mapping to a root directory which has an index.html file.
  2. Add custom location to reverse proxy.

Describe alternatives you've considered

Use native nginx.

Additional context

Originally created by @jearton on GitHub (Mar 5, 2022). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/1913 <!-- Are you in the right place? - If you are looking for support on how to get your upstream server forwarding, please consider asking the community on Reddit. - If you are writing code changes to contribute and need to ask about the internals of the software, Gitter is the best place to ask. - If you think you found a bug with NPM (not Nginx, or your upstream server or MySql) then you are in the *right place.* --> **Is your feature request related to a problem? Please describe.** <!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --> No. **Describe the solution you'd like** <!-- A clear and concise description of what you want to happen. --> 1. Add root location mapping to a root directory which has an index.html file. 2. Add custom location to reverse proxy. **Describe alternatives you've considered** <!-- A clear and concise description of any alternative solutions or features you've considered. --> Use native nginx. **Additional context** <!-- Add any other context or screenshots about the feature request here. -->
kerem 2026-02-26 07:30:48 +03:00
Author
Owner

@jearton commented on GitHub (Mar 26, 2022):

I found a solution through reading the source code. Just add the root location directive block in the proxy advanced configuration, then the root location of reverse proxy will not be generated. The relevant source code is as follows:

https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/backend/internal/nginx.js#L220
image

https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/backend/templates/proxy_host.conf#L29
image

<!-- gh-comment-id:1079719859 --> @jearton commented on GitHub (Mar 26, 2022): I found a solution through reading the source code. Just add the root location directive block in the proxy advanced configuration, then the root location of reverse proxy will not be generated. The relevant source code is as follows: https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/backend/internal/nginx.js#L220 ![image](https://user-images.githubusercontent.com/10370433/160246993-ef60e0c5-cf07-4d48-acb8-8d8456234ffb.png) https://github.com/NginxProxyManager/nginx-proxy-manager/blob/develop/backend/templates/proxy_host.conf#L29 ![image](https://user-images.githubusercontent.com/10370433/160247046-7318453e-453e-460a-b241-7b7b05394a1f.png)
Author
Owner

@florianchevallier commented on GitHub (Feb 10, 2023):

To complete the response here :

you can create a dummy nginx conf like this :

image

And then add an advanced configuration like this

root                   /downloads;
location / {
  autoindex             on;
  autoindex_exact_size  on;
  autoindex_format      html;
  autoindex_localtime   on;
}

⚠️ the path has to be mounted in you docker / docker-compose file.

<!-- gh-comment-id:1425639448 --> @florianchevallier commented on GitHub (Feb 10, 2023): To complete the response here : you can create a dummy nginx conf like this : ![image](https://user-images.githubusercontent.com/42930731/218076664-6cb5bd38-26a2-46d9-b739-4b623f7a7933.png) And then add an advanced configuration like this ```nginx root /downloads; location / { autoindex on; autoindex_exact_size on; autoindex_format html; autoindex_localtime on; } ``` ⚠️ the path has to be mounted in you docker / docker-compose file.
Author
Owner

@ymjlabMax commented on GitHub (Feb 20, 2024):

I have a question.

What does http://localhost:11111/ mean?

root /deploy;
location / {
autoindex on;
autoindex_exact_size on;
autoindex_format html;
autoindex_localtime on;
}

Should the root location here be aligned with the docker-compose file location?

I'm asking because I'm currently encountering a 404 not-found error.

<!-- gh-comment-id:1953506268 --> @ymjlabMax commented on GitHub (Feb 20, 2024): I have a question. What does http://localhost:11111/ mean? root /deploy; location / { autoindex on; autoindex_exact_size on; autoindex_format html; autoindex_localtime on; } Should the root location here be aligned with the docker-compose file location? I'm asking because I'm currently encountering a 404 not-found error.
Author
Owner

@dyingway commented on GitHub (Apr 4, 2024):

I have a question.

What does http://localhost:11111/ mean?

root /deploy; location / { autoindex on; autoindex_exact_size on; autoindex_format html; autoindex_localtime on; }

Should the root location here be aligned with the docker-compose file location?

I'm asking because I'm currently encountering a 404 not-found error.

the guy had mention,⚠️ the path has to be mounted in you docker / docker-compose file.

i think you might don't know how to do,so i give a example,if your html files location in /srv
then ,you should edit your docker-compose.yml like this:

    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
      - /srv:/srv

then 404 will disappear

<!-- gh-comment-id:2037528145 --> @dyingway commented on GitHub (Apr 4, 2024): > I have a question. > > What does http://localhost:11111/ mean? > > root /deploy; location / { autoindex on; autoindex_exact_size on; autoindex_format html; autoindex_localtime on; } > > Should the root location here be aligned with the docker-compose file location? > > I'm asking because I'm currently encountering a 404 not-found error. the guy had mention,⚠️ the path has to be mounted in you docker / docker-compose file. i think you might don't know how to do,so i give a example,if your html files location in `/srv` then ,you should edit your docker-compose.yml like this: ``` volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt - /srv:/srv ``` then 404 will disappear
Author
Owner

@github-actions[bot] commented on GitHub (Nov 29, 2024):

Issue is now considered stale. If you want to keep it open, please comment 👍

<!-- gh-comment-id:2506957330 --> @github-actions[bot] commented on GitHub (Nov 29, 2024): Issue is now considered stale. If you want to keep it open, please comment :+1:
Author
Owner

@github-actions[bot] commented on GitHub (Dec 5, 2025):

Issue was closed due to inactivity.

<!-- gh-comment-id:3615034974 --> @github-actions[bot] commented on GitHub (Dec 5, 2025): Issue was closed due to inactivity.
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#1393
No description provided.