Thursday, May 16, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 791  / 3 Years ago, sun, may 16, 2021, 12:17:01

I want to set up a website with the root /home/x/y.
The problem is, that I get a 403 Forbidden error, although
the configuration files are set up correctly, aren't they?
Here are the configs I edited and the permission states of
the website root directory


Input


$ nano /etc/apache2/apache2.conf

Output


...
<Directory /home/x/y>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
...

Input


$ nano /etc/apache2/sites-available/x.conf

Output


<VirtualHost *:80>
ServerAdmin [email protected]
ServerName x.y.org
ServerAlias www.x.y.org
DocumentRoot /home/x/y
ErrorLog ${APACHE_LOG_DIR}/domain.com_error.log
CustomLog ${APACHE_LOG_DIR}/domain.com_access.log combined

<Directory "/home/x/y">
Order allow,deny
Allow from all
Require all granted
</Directory>

RewriteEngine on
RewriteCond %{SERVER_NAME} =www.x.y.org [OR]
RewriteCond %{SERVER_NAME} =x.y.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Input


$ ls -ld x/

Output


drwxr-xr-x 7 root root 4096 Jan 25 21:18 x/

Input


$ ls -ld x/y/

Output


drwxrwxrwx 3 root www-data 4096 Jan 25 21:44 x/y/

Edit: Yes, all parent directories of the folder y have the execution permission.


More From » permissions

 Answers
3

There was a config beside x.conf called x-le-ssl.conf with an old configuration - a configuration pointing to a directory that did not exist anymore. Apache used this file instead and so threw me the 403 error. Just change this config too or re create it by sudo certbot --apache -m [email protected] -d example.com -d www.example.com and it will hopefully work.


[#2033] Sunday, May 16, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elopingapo

Total Points: 206
Total Questions: 110
Total Answers: 114

Location: Guam
Member since Tue, Nov 29, 2022
1 Year ago
elopingapo questions
Fri, Sep 10, 21, 17:52, 3 Years ago
Tue, May 24, 22, 00:42, 2 Years ago
Sat, Apr 23, 22, 03:16, 2 Years ago
Fri, Jan 13, 23, 06:41, 1 Year ago
Sat, Jun 11, 22, 10:16, 2 Years ago
;