- Docker.io must be installed and set up.
- Ensure all necessary ports & firewalls are opened in case of Cloud VMs.
- Git must be installed on the VMs.
- Nano text-editor & Tree if needed.
-
Clone the Repository:
- Clone this repository to your local directory:
git clone https://github.com/AbhiGT997/nginx-custom-websites.git
- Navigate to the cloned repository:
cd nginx-simple
- Clone this repository to your local directory:
-
Select and Copy the Project:
- Navigate to the project files directory and select the project you want to deploy on Nginx:
cd project-files/projects - Copy the selected project folder to the main directory:
cp -r ~/nginx-simple/project-files/projects/<project-name> ~/nginx-simple
- Navigate to the project files directory and select the project you want to deploy on Nginx:
-
Edit the Dockerfile:
- Open the Dockerfile in Nano:
nano Dockerfile
- Replace the
<replace-with-folder-name>placeholder with the name of the selected project folder. - Ensure the folder containing HTML, CSS, JS, etc., files is in the
/nginx-simpledirectory or customize the Dockerfile accordingly.
- Open the Dockerfile in Nano:
-
Build the Docker Image:
- Build the Docker image using the following command:
docker build -t nginx:1.0 .
- Build the Docker image using the following command:
-
Run the Docker Container:
- Run the container with the following command:
docker run -d -t --name nginx-custom-webcontent -p 7000:80 nginx:1.0
- You can use a custom name and port if needed. In the example above,
7000is the local port and80is the container port.
- Run the container with the following command: