Replies: 7 comments
-
Update: I have been able to workaround it: I modified default.conf to remove the 503 return
How do I ensure that this part of default.conf isn't changed. Should I update nginx.tmpl or is there a builtin way to do it? Thanks! |
Beta Was this translation helpful? Give feedback.
-
From what I understand you want to serve static content on the domain belonging to the server itself. Let's call that domain There is nothing that makes this domain special, and you can serve it like you would any other. I see two approaches you could take.
docker run -d -v /path/to/sources:/srv/http -e VIRTUAL_HOST=host.domain.com -e VIRTUAL_PORT=8043 pierrezemb/gostatic
I would recommend (1), as it is much simpler to configure. |
Beta Was this translation helpful? Give feedback.
-
Thanks, so it's not possible to do without adding a container? Is this something that you would consider for a feature request?
…-------- Original Message --------
On Aug 28, 2020, 01:30, Tom Wiesing wrote:
From what I understand you want to serve static content on the domain belonging to the server itself. Let's call that domain host.domain.com.
There is nothing that makes this domain special, and you can serve it like you would any other.
Therefore I don't think you have to modify nginx.tmpl to achieve this effect.
I see two approaches you could take.
For either approach, you should also rename your certificates to host.domain.com.crt and host.domain.com.key.
- Create a docker container that has VIRTUAL_HOST=host.domain.com set and serves only the static files. There are many of those available, one being https://github.com/PierreZ/goStatic. This would be something like:
docker run -d -v /path/to/sources:/srv/http -e VIRTUAL_HOST=host.domain.com -e VIRTUAL_PORT=8043 pierrezemb/gostatic
- You could make use of [Per-VIRTUAL_HOST location configuration](https://github.com/nginx-proxy/nginx-proxy#per-virtual_host-location-configuration). To achieve that you would create a dummy container, that doesn't serve anything but has the VIRTUAL_HOST=host.domain.com variable set. You could mount the file /etc/nginx/vhost.d/host.domain.com_location inside the nginx-proxy container and insert any directives that you want inside it (including serving static content).
I would recommend (1), as it is much simpler to configure.
Furthermore, you might also want to set it as the [DEFAULT_HOST](https://github.com/nginx-proxy/nginx-proxy#default-host), which causes any unknown domain (like e.g. connecting directly to the IP Address) to be treated as this domain.
—
You are receiving this because you authored the thread.
Reply to this email directly, [view it on GitHub](#1493 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AAHH5PNE6RZLGBAQPTZ25RTSC5FGTANCNFSM4QNMOAPQ).
|
Beta Was this translation helpful? Give feedback.
-
Maybe my front end is not deployed here, but when I visit the ip, it also returns 503 Service Temporarily Unavailable. I just don’t want him to return an error. Maybe it can map an index.html file like nginx. |
Beta Was this translation helpful? Give feedback.
-
Now I closed port 80 of the server's firewall and, I’m thinking about whether port 80 can be undisclosed in nginx-proxy |
Beta Was this translation helpful? Give feedback.
-
You can put your two server definitions in a config file and mount it to If you replace the You might also need to make sure the config filename is alphabetically later than |
Beta Was this translation helpful? Give feedback.
-
I have the same problem being discussed here, but I'm confused because the letsencrypt companion needs to serve static content for the |
Beta Was this translation helpful? Give feedback.
-
Questions
If you have a question, DO NOT SUBMIT a new issue. Please ask the question on the Q&A Group: https://groups.google.com/forum/#!forum/nginx-proxy
Group does not exist
I am trying to get the default path https://host.domain.com/ to serve the content in /usr/share/nginx/html. This is not a vhost but the main server itself. I was able to get it to start with https by renaming the ssl certs as "default" but it always returns 503 Service Temporarily Unavailable
What is required to get it to serve this content? I do of course plan on adding virtual hosts but I need the default root to also serve content on 443.
Thanks
Beta Was this translation helpful? Give feedback.
All reactions