You are on page 1of 5

Assignment to install nginx using docker

Step-1 : Start ec2 ubuntu instance

# sudo apt-get update


Step- 2: Install docker engine using command

# sudo apt-get install docker.io -y

# docker –version

Step- 3: Give permission to user for docker

# sudo usermod -a -G docker $USER

# sudo reboot

After reboot reconnect with instance

Step- 4: Pull nginx image

# docker pull ubuntu/nginx:latest


Step- 5: Run nginx docker image

# docker run -d --name nginx-container -p 8080:8080 ubuntu/nginx:latest

Step- 6: Open port 8080 in EC2 Security group

Step- 7:

Copy EC2 instance public ip and paste it in browser

Final output of nginx index page

Step- 8: Configuring index.html about other pages

Make new directory

Create custom index.html and custom about.html files


Check present working directory path

Run docker image by assigning our new custom path for index.html of nginx

Default nginx has path as /usr/share/nginx/html

Output for custom index.html page


About us page

Making changes to about us page

You might also like