M
M
Maxim2019-11-14 08:23:18
Apache HTTP Server
Maxim, 2019-11-14 08:23:18

Why 403 error in httpd?

Hello.
There is a virtual host. If you specify the path to a local directory, then 200 is OK.

<VirtualHost 78.bbbb.121>
        ServerAdmin [email protected]
        DocumentRoot /www/docs/gitlab.xxx.site
        ServerName gitlab.xxx.site
        ErrorLog logs/gitlab.xxx.site/gitlab.xxx-error_log
        CustomLog logs/gitlab.xxx-access_log common
RewriteEngine on
RewriteCond %{SERVER_NAME} =gitlab.xxx.site
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Permissions on /www/docs/gitlab.xxx.site
[[email protected] ~]# ls -l /www/docs/gitlab.xxx.site/
total 4
-rw-r--r--. 1 root root 4 Nov 14 12:35 index.html
[[email protected] ~]# ls -ld /www/docs/gitlab.xxx.site/
drwxr-xr-x. 3 root root 4096 Nov 14 12:35 /www/docs/gitlab.xxx.site/

If you specify the path to the mounted directory, then 403 Forbidden.
<VirtualHost 78.bbbb.121>
        ServerAdmin [email protected]
        DocumentRoot /mnt/gitlab
        ServerName gitlab.xxx.site
        ErrorLog logs/gitlab.xxx.site/gitlab.xxx-error_log
        CustomLog logs/gitlab.xxx-access_log common
RewriteEngine on
RewriteCond %{SERVER_NAME} =gitlab.xxx.site
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

Permissions on /mnt/gitlab
[[email protected] ~]# ls -l /mnt/gitlab/
total 4
-rw-r--r--. 1 root root 12 Nov 13 19:51 index.html
[[email protected] ~]# ls -ld /mnt/gitlab/
drwxr-xr-x. 1 root root 4096 Nov 14 15:04 /mnt/gitlab/

What could be the reason?

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
M
Maxim, 2019-11-14
@MaxRAF

I will add. The problem occurs when SSL is used

[Thu Nov 14 16:14:22.582357 2019] [core:error] [pid 25431] (13)Permission denied: [client 31.xx.xx.202:63223] AH00035: access to / denied (filesystem path '/mnt/gitlab') because search permissions are missing on a component of the path

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question