sudo mkdir -p /var/www/example.com/html
sudo chown -R $USER:$USER /var/www/example.com/html
sudo chmod -R 755 /var/www
nano /var/www/example.com/html/index.html
<html>
<head>
<title>Example website</title>
</head>
<body>
<h1>Test page</h1>
</body>
</html>
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/example.com
sudo nano /etc/nginx/sites-available/example.com
server {
listen 80 default_server;
listen [::]:80 default_server;
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 nano /etc/nginx/nginx.conf
http {
. . .
server_names_hash_bucket_size 64;
. . .
}
sudo nginx -t
sudo systemctl restart nginx
http://www.example.com