Skip to content

Instantly share code, notes, and snippets.

@JoseAndresHV
Last active December 2, 2023 23:24
Show Gist options
  • Save JoseAndresHV/4cc3f97b3023a666f64d71f7b8929dd2 to your computer and use it in GitHub Desktop.
Save JoseAndresHV/4cc3f97b3023a666f64d71f7b8929dd2 to your computer and use it in GitHub Desktop.
How to create an Apache Web Server in a Docker Container

Apache Web Server in a Docker Container

1. Download Apache Server Image

docker pull httpd

2. Create a Container

Public requests port 8080port 80 on the Container
Map /home/user/website//usr/local/apache2/htdocs/

docker run -dit --name webserver -p 8080:80 -v /home/user/website/:/usr/local/apache2/htdocs/ httpd:latest

3. Create index.html

nano /home/user/website/index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Apache Web Server</title>
</head>
<body>
    <h1>Aprendiendo Docker</h1>   
</body>
</html>

4. Open in browser

Show host’s public IP address:

ifconfig

image

Web Url: http://192.168.0.29:8080/

image

@ENez7
Copy link

ENez7 commented Feb 19, 2022

Te saltaste un minuto en el diamante 7:45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment