K
K
Khaybulla Musaev2015-08-23 01:41:39
Regular Expressions
Khaybulla Musaev, 2015-08-23 01:41:39

Document_root on the /home/username/srv folder persistently produces a 403 error. What am I doing wrong?

I took ssd vds to play around, lay out my scripts.
Installed LAMP stack, moving document_root from /var/www/ folder to /home/username/srv/ for convenience.
Stubbornly gives 403 error.
I climb into Google, they write - give the rights to the / srv folder to the user www-data. I do it differently - I add the www-data user to the username group. It turns out that now the user is subject to the rights of the group owner of the folder, namely, the second digit in the access rights. And I have rights to folder 775.
Further - more. I set the rights to 777 on all folders both down the tree and up. Same result.
I add the www-data user to the root group. Again 403 error.
I checked from whom Apache starts the process - www-data, everything is correct.
Where to dig - I'll never know.
Posting the config file

GNU nano 2.2.6  File: /etc/apache2/sites-available/musaevhs.ru.conf           
 
<VirtualHost *:80>
        ServerName musaevhs.ru
 
        ServerAdmin [email][email protected][/email]
        DocumentRoot /home/musaevhs/srv/public_html/
 
        <Directory /home/musaevhs/srv/public_html>
                Options FollowSymLinks
                AllowOverride None
                Require all granted
        </Directory>
 
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
 
</VirtualHost>
 
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
dodo512, 2019-02-27
@Spekals

https://habr.com/en/company/sprinthost/blog/129560/
If .htaccess is in the /test/ folder, then instead of ^test/(first|second|third)$it should be ^(first|second|third)$
The [L] flag ends processing all rules only in <VirtualHost>, and in .htaccess the request will go through all RewriteRule again and again, until it stops changing.
Since Apache 2.3.9, the END flag is available

RewriteEngine On
RewriteRule ^(first|second|third)$ index.html [END]
RewriteRule ^(.+)$ 404.html [END]

K
Khaybulla Musaev, 2015-11-05
@musaev_haybulla

No, there were directives in the main configuration file that prohibited reading from the folders of the home directory.

F
foboss, 2015-08-23
@foboss

Check if there are any Posix ACLs on the /home folder on the hosting:
wiki.rsu.edu.ru/wiki/Posix_ACLs
Well, of course, SELinux is worth checking, maybe it is blocking something.

V
Vlad Zhivotnev, 2015-08-24
@inkvizitor68sl

Selinux/apparmor check, check that the config is correct and that Apache is running with it (check that the pids of all processes change upon restart).
Make su www-data as root and go through the entire directory tree with ls -la, see where it stumbles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question