mirror of
https://github.com/bpetschowitsch/weba.git
synced 2026-06-01 16:39:42 +00:00
1.3 KiB
1.3 KiB
hello world
instruction to prepare nginx site configuration
nginx site configuration
the site configuration is created within /etc/nginx/sites-available/
cd /etc/nginx/sites-available
create a new file for the domain...or easier, copy the exisiting one:
sudo cp default *my_domain*
and edit the file:
sudo vi *my_domain*
server {
listen 80;
listen [::]:80;
server_name *my_domain*;
root /var/www/*my_domain*/;
index index.html index.htm index.nginx-debian.html;
location / {
try_files $uri $uri/ =404;
}
}
folder structure
change to directory /var/www/:
cd /var/www/
and create a subfolder for the own domain/website:
sudo mkdir /var/www/*my_domain*
sudo chown www-data:www-data /var/www/*my_domain*
create hello-world index.html
sudo vi /var/www/*my_domain*/index.html
<html>
<head>
<title>Welcome!</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
sudo chown www-data:www-data index.html
enable, verify and restart
enable the new site:
sudo ln -s /etc/nginx/sites-available/*my_domain* /etc/nginx/sites-enabled/*my_domain*
validate configuration:
sudo nginx -t
restart nginx:
sudo systemctl restart nginx