简体   繁体   中英

Docker and apache2, remove port from url

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 ?

You have 2 Options:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM