Out of the box I am getting a 403 Forbidden error on a new virtual host.
I am using as simple of a server block as possible
server {
listen 80;
listen [::]:80;
server_name carttest.tabletopstock.com;
root /var/www/carttest1/public;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
The permissions for /var/www/carttest1/public are:
drwxrwxr-x 4 tyson www-data 4096 Jan 30 23:22 public
Same with the permissions of the files within it.
drwxrwxr-x 4 tyson www-data 4096 Jan 30 23:22 .
drwxrwxr-x 14 tyson www-data 4096 Jan 30 23:44 ..
-rw-rw-r-- 1 tyson www-data 593 Jan 30 23:22 .htaccess
drwxrwxr-x 2 tyson www-data 4096 Jan 30 23:22 css
-rw-rw-r-- 1 tyson www-data 0 Jan 30 23:22 favicon.ico
-rw-rw-r-- 1 tyson www-data 1823 Jan 30 23:22 index.php
drwxrwxr-x 2 tyson www-data 4096 Jan 30 23:22 js
-rw-rw-r-- 1 tyson www-data 71 Jan 30 23:22 mix-manifest.json
-rw-rw-r-- 1 tyson www-data 24 Jan 30 23:22 robots.txt
-rw-rw-r-- 1 tyson www-data 1194 Jan 30 23:22 web.config
I have tried setting the owner to www-data as well to no effect.
And in sudo tail -f /var/log/nginx/error.log I constantly get
*1 directory index of "/var/www/carttest1/public/" is forbidden, client: 131.252.165.128, server: carttest.tabletopstock.com, request: "GET / HTTP/1.1", host: "carttest.tabletopstock.com"
Am I missing a flag somewhere?
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!
Hello,
The problem is that in your Virtual Host you have set only index.html as an index but in your public folder, you only have index.php so Apache is failing to find a directory index.
To fix that either add index.php to your index list like this:
index index.php index.html;
Or change the index.html to index.php:
index index.php;
After that run a config test:
sudo apache2ctl -t
And if you get Syntax OK, then restart Apache and it should work as expected:
systemctl restart apache2
Regards, Bobby
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.