I’ve got a new Ubuntu 18.04 droplet on DO, by following this guide. Just installed Nginx and Ufw (which is disabled for now) on it. I’ve this conf file inside the /etc/nginx/conf.d folder.
server {
listen 80 ;
listen [::]:80 ;
root /var/www/2;
index index.html index.htm index.nginx-debian.html;
server_name 2.hotelbobbygg.xyz;
location / {
try_files $uri $uri/ =404;
}
}
In the error log, this is written *7 directory index of "/var/www/2/" is forbidden, client: 139.5.37.198, server: 2.hotelbobbygg.xyz, request: "GET / HTTP/1.1", host: "2.hotelbobbygg.xyz"
I’ve also tried commenting out the 3rd line from last, i.e. try_files line. But it still behaves the same. Pls help what is preventing me to access the index.html lying inside /var/www/2 folder.
And if I used below given text in that …/conf.d/2.conf file (replacing what is already there), then also it doesn’t succeed (rather falls back on serving the /usr/share/nginx/html/index.html).
server {
listen 80; listen [::]:80;
server_name 2.hotelbobbygg.xyz; # <-- change this
location /.well-known/acme-challenge/ {
root /var/www;
}
location / {
return 301 https://$host$request_uri;
}
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
I deleted that ‘default’ file (or its link in the sites-enabled).
Index file is serving ok from that very location /var/www/2. I’ve copied that very file from some other working locations.
Hello, @zopfans
Can you check the site configuration file and make sure everything is okay? The one in:
/etc/nginx/sites-available/
and see the root directory of the site itself. Let me know how it goes.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.