This repository contains the build artifacts required to deploy a website on Nginx (Linux Web Server).
Follow the steps below to deploy the application successfully.
- Linux OS (Ubuntu recommended)
- Sudo / root access
- Nginx installed
Run the following commands:
sudo apt update
sudo apt install nginx -yStart and enable Nginx:
sudo systemctl start nginx
sudo systemctl enable nginxVerify installation by opening browser:
http://localhost
- Download the ZIP artifacts from this GitHub repository
- Extract the ZIP file:
unzip your-artifact.zipDefault Nginx web directory:
/var/www/html
Copy files:
sudo cp -r * /var/www/html/Set correct permissions:
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/htmlEdit default config:
sudo nano /etc/nginx/sites-available/defaultUpdate root path if needed:
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}Test config:
sudo nginx -tRestart Nginx:
sudo systemctl restart nginxOpen browser:
http://localhost
Your website should now be live on Nginx 🎉
Agar tu bata de ki project React / Angular / Node / static kya hai, toh main exact optimized Nginx config bhi bana dunga (reverse proxy, SPA routing, etc.).