• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Apache24 virtualhost - permission denied

bryn1u

Well-Known Member

Thanks: 2
Messages: 287

#1
Hello,

I'm trying to make a virtualhost for 1 user. I had it before and worked great. It's weir for me becouse i reinstalled server and still getting error related with permissions.

My vhost:
Code:
[root@proton /usr/local/etc/apache24/Includes]# service apache24 restart
Performing sanity check on apache24 configuration:
Syntax OK
apache24 not running? (check /var/run/httpd.pid).
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.
[root@proton /usr/local/etc/apache24/Includes]# cat bryn1u.conf
<VirtualHost *:80>
        ServerAdmin bryn1u@proton.edu.pl
        ServerName bryn1u.proton.edu.pl
        ServerAlias www.bryn1u.proton.edu.pl
    
        DocumentRoot "/home/bryn1u/domains/bryn1u.proton.edu.pl"
    
        <Directory /home/bryn1u/domains/bryn1u.proton.edu.pl>
                AllowOverride None
                Order Allow,Deny
                Allow from all
        </Directory>

#    ErrorLog "/home/bryn1u/domains/bryn1u.proton.edu.pl"
#    CustomLog "/home/bryn1u/domains/bryn1u.proton.edu.pl" common
</VirtualHost>
[root@proton /usr/local/etc/apache24/Includes]#
I added dns record to named. Domain works without any problem. When i want to go to the main site proton.edu.pl im getting:
Forbidden
You don't have permission to access / on this server.
From /var/log/httpd-error.lo
Code:
[Sat Oct 14 12:34:57.208121 2017] [authz_core:error] [pid 15205] [client 46.76.150.165:42194] AH01630: client denied by server configuration: /home/bryn1u/domains/bryn1u.proton.edu.pl/
[Sat Oct 14 12:34:57.508121 2017] [authz_core:error] [pid 15205] [client 46.76.150.165:42194] AH01630: client denied by server configuration: /home/bryn1u/domains/bryn1u.proton.edu.pl/favicon.ico
[Sat Oct 14 12:34:57.588106 2017] [authz_core:error] [pid 15205] [client 46.76.150.165:42194] AH01630: client denied by server configuration: /home/bryn1u/domains/bryn1u.proton.edu.pl/favicon.ico
[Sat Oct 14 12:39:06.647983 2017] [authz_core:error] [pid 88407] [client 46.76.150.165:42254] AH01630: client denied by server configuration: /home/bryn1u/domains/bryn1u.proton.edu.pl/
Before i was trying change root directory in httpd.conf, ServerRoot and many other ways. Nothing helped. I reinstalled apache24 and is clear. Only vhost has been added.

Permissions on folders are 755. Userdirs works without any problems.
I have nothing changed in httpd.conf
What am i doing wrong ?
Thanks,
 

obsigna

Aspiring Daemon

Thanks: 336
Messages: 648

#2
The directives for controlling permissions were changed for Apache 2.4 compared to Apache 2.2. You are using the Apache 2.2 syntax -- see: https://httpd.apache.org/docs/current/upgrading.html

Either use the directive Require all granted instead of the Order .../Allow ... combo, or enable the 2.2 compatibility module mod_access_compat in httpd.conf:
Code:
...
LoadModule access_compat_module libexec/apache24/mod_access_compat.so
...
 

bryn1u

Well-Known Member

Thanks: 2
Messages: 287

#3
The directives for controlling permissions were changed for Apache 2.4 compared to Apache 2.2. You are using the Apache 2.2 syntax -- see: https://httpd.apache.org/docs/current/upgrading.html

Either use the directive Require all granted instead of the Order .../Allow ... combo, or enable the 2.2 compatibility module mod_access_compat in httpd.conf:
Code:
...
LoadModule access_compat_module libexec/apache24/mod_access_compat.so
...
Thank you for your advice.
I have changed:
On Required all granted but i have a still the same issue:
Output httpd -S
Code:
[root@proton /var/log]# httpd -S
VirtualHost configuration:
*:80                   bryn1u.proton.edu.pl (/usr/local/etc/apache24/Includes/bryn1u.conf:1)
ServerRoot: "/usr/local"
Main DocumentRoot: "/usr/local/www/apache24/data"
Main ErrorLog: "/var/log/httpd-error.log"
Mutex default: dir="/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www" id=80
Group: name="www" id=80
[root@proton /var/log]#
Code:
root@proton:/ # cat usr/local/etc/apache24/Includes/bryn1u.conf
<VirtualHost *:80>
    ServerAdmin admin@example.org
        ServerName bryn1u.proton.edu.pl
        ServerAlias www.bryn1u.proton.edu.pl
     
        DocumentRoot "/home/bryn1u/domains/bryn1u.proton.edu.pl"
     
        <Directory /home/bryn1u/domains/bryn1u.proton.edu.pl>
                AllowOverride None
           Require all granted
   </Directory>

#    ErrorLog "/home/bryn1u/domains/bryn1u.proton.edu.pl"
#    CustomLog "/home/bryn1u/domains/bryn1u.proton.edu.pl" common
</VirtualHost>


I have no idea what am i doing wrong. ehhh
After this change, additionally im getting:
Code:
[Sat Oct 14 13:43:39.827177 2017] [autoindex:error] [pid 71900] [client 46.76.150.165:42696] AH01276: Cannot serve directory /home/bryn1u/domains/bryn1u.proton.edu.pl/: No matching DirectoryIndex (index.php,index.html) found, and server-generated directory index forbidden by Options directive
## Edit:
I have add Options +Indexes and i can finally see my content. Thank you for your help im really greateful.