nginx-proxy-manager icon indicating copy to clipboard operation
nginx-proxy-manager copied to clipboard

How to add a static website for root location?

Open jearton opened this issue 3 years ago • 3 comments

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

jearton avatar Mar 05 '22 20:03 jearton

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

jearton avatar Mar 26 '22 15:03 jearton

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.

florianchevallier avatar Feb 10 '23 11:02 florianchevallier

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.

ymjlabMax avatar Feb 20 '24 05:02 ymjlabMax

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

dyingway avatar Apr 04 '24 15:04 dyingway