A comprehensive guide to quickly set up Nginx on Ubuntu for your website. Follow these steps carefully.
sudo apt update
sudo apt install nginx
After installation, verify Nginx is running by accessing your server IP in a web browser.
Replace example.com with your actual domain name.
sudo mkdir -p /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.com/html
sudo chmod -R 755 /var/www/example.com
Create a simple HTML page to test your setup:
sudo nano /var/www/example.com/html/index.html
<html>
<head>
<title>Welcome to example.com</title>
</head>
<body>
<h1>Hi Welcome to Example.com</h1>
</body>
</html>
sudo nano /etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ =404;
}
}
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
Watch this step-by-step video guide for visual instructions.
Need help? Contact support
© 2023 tomskbs.info - All rights reserved