Hello every body. Hope all of you are healthy.
Playing around with Docker containers and web servers, I am facing a “challenge”.
I run Apache as web server in CentOS 8.
I have already set up many virtual hosts and they are running smoothly.
Additionally I have made entries with imaginary domain names in local /etc/hosts file and they are serving normally thanks to Apache names based virtual hosts.
Now I want to serve Docker containers instead of simple html pages.
All of them are accessible with Docker command -p 8080:80 and more over are accessible with imaginary domain names only if I add port on my web server. For example:
Now I want to access them with our adding the port at the end.
I found the below code in git hub but is not working for me.
CustomLog logs/docker.example.com_access.log combined
Allow from all
any help would be appreciated.
I basically found the same info as you: Simple Apache reverse proxy example | JamesCoyle.net Limited
But it’s really hard to troubleshoot if you only post the generic example, and not a concrete example of your config. Also, it would be nice to know exactly what is not working.
Could you post an example of the config file exactly as it would be for you (for an imaginary or real service) and also be specific about what errors you get etc. (log output for instance)?
Also please list ‘docker ps’ so we can see your forwarded ports in docker.
This is how I wrote the code inside /etc/http/sites-available. (one of the variations that I have tried already)
CustomLog logs/nextcloud1.net_access.log combined
Allow from all
I’m receiving this error:
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
If I type in browser
page is serving normally. (/etc/hosts entry include nextcloud1.net)
Without being entirely sure, I would think reverse proxy works only on subdomains, so it should be nextcloud.home.net (or something similar).
I’m not aware how reverse proxy works “directly” on main domains (nextcloud1.net).
What happens if you put the server’s IP address instead of localhost in the proxypass?
Besides, I’m not familiar with Apache, so this is completely random troubleshooting for my part.
I’m not sure if this is a typo on here or not but you don’t have the ProxyPassReverse line on your location settings. I’m not even a little familiar with reverse proxy in apache so I’m not sure if this was intentional or not.
Good catch - of course one of the lines need to be ProxyPassReverse.