0

I'm working with Docker on an Ubuntu server, and I have an Apache2 container.

This container is working, if I go to http://my-server-ip:8080, I can see my folders and files in the folder /var/www/html of my Apache2 container.

/var/www/html in the container is linked with the folder /home/me on my machine. So I work directly in /home/me.

Now I need to add a VirtualHost for redirect a subdomain to a specific folder /var/www/html/portfolio.

So I connect to my container and add a new host like :

<VirtualHosT *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/portfolio
    ServerName my.subdomain.com
    ServerAlias my.subdomain.com
</VirtualHost>

The result is when I go to my.subdomain.com:8080 it's ok, I can read the content of /var/www/html/portfolio, but my question is :

How can I remove the :8080 in the URL ?

Clément Andraud
  • 9,103
  • 25
  • 80
  • 158
  • Have you checked: http://webmasters.stackexchange.com/questions/23228/how-do-i-hide-the-port-in-my-url and http://stackoverflow.com/questions/11330552/rewrite-rule-to-hide-port-from-url-of-rails-server also http://stackoverflow.com/questions/13155529/how-to-remove-port-number-from-http-localhost8123-to-use-as-http-localhost? – Birdy Nov 17 '16 at 15:04
  • how is your container being run? do you have -p 8080:xxxx there? – user3012759 Nov 17 '16 at 15:19

1 Answers1

0

You have 2 Options:

  1. Publish your container on port 80, this requires docker host to have port 80 as a free port.

  2. Use another nginx on port 80 and reverse proxy to your apache container that runs on port 8080.

Farhad Farahi
  • 35,528
  • 7
  • 73
  • 70