I'm working on a mac, using VirtualBox and Ubuntu server 20.04 using a Bridged Connection. I have set up the Nginx server and the default page is loading. I was able to edit /var/www/html/index.html to say hello world. I can view this default page by visiting http://ip/.
The server blocks files in /var/www/ are named 'html' (the default), 'site1' and 'site2' All the 'site' maps have a html map inside of them, containing index.html with some HelloWorld text inside of them.
All the above code/info should be correct. Therefore, I assume that the error is in the configuration.
/etc/nginx/sites-enabled contain 3 files. 'default', 'site1' and 'site2'. I will show the 'default' file and the 'site1' file in the code below.
Going to http://site1/ results in an error page, chrome displays an IP error instead of the index.html file.
Could someone show me what I'm doing wrong?
Site1 file:
server {
listen 80;
listen [::]:80;
root /var/www/site1/html;
index index.html index htm index.nginx-debian.html;
server_name site1 www.site1;
location / {
try_files $uri $uri/ =404;
}
}
Default file:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}