Deploying a website to a server
- Website is generally written in html, javascript, css
- To deploy a website, we need a webserver (nginx, apache, iis)
- To install webserver we need a linux or windows machine
-
Lets create a linux instance(ubuntu 24.04) on cloud and deploy a website
-
Steps
sudo apt update
sudo apt install apache2 -y
# webserver is installed
cd /tmp
wget https://templatemo.com/tm-zip-files-2020/templatemo_617_pixel_forge.zip
sudo apt install unzip -y
unzip templatemo_617_pixel_forge.zip
cd templatemo_617_pixel_forge/
ls
- To host this website, we need to copy the contents into /var/www/html
sudo cp -R . /var/www/html

To run this in a container
- We have two options
- Take a container with ubuntu (docker image)
- install webserver
- copy website
- Take a container with apache (docker image)
- Docker has a place where images are already available => registry
- Images will have naming convention
<name>:<tag>
- name refers to application
- tag refers to version
- For apache
httpd:2
-
Containerization is process of making your application run inside a container.
-
For containerization we have two ways