Why does Apache return forbidden?
There is no .htaccess
file in the root of the site, but index.php
is present. Why does a 403 error occur when requesting a site?
Rights to all folders - 755, to all files-644, owner-root
It costs php 7.0.20
Apache configs
<VirtualHost *:80>
ServerName myserver.com.ua
ServerAdmin webmaster@localhost
DocumentRoot /var/www_myserver.com.ua
<Directory /var/www_myserver.com.ua>
# Options -Indexes +FollowSymLinks -MultiViews
# AllowOverride all #Deprecated
# Order allow,deny #Deprecated
# Allow from all #Deprecater
# Require all granted
</Directory>
LogLevel alert rewrite:trace3
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www_myserver.com.ua
ServerName myserver.com.ua
#SSLEngine on
#SSLCertificateFile /etc/apache2/ssl/server.crt
#SSLCertificateKeyFile /etc/apache2/ssl/server.key
<Directory /var/www_myserver.com.ua>
# Options -Indexes +FollowSymLinks -MultiViews
# AllowOverride all #Deprecated
# Order allow,deny #Deprecated
# Allow from all #Deprecated
# Require all granted #Deprecated
</Directory>
</VirtualHost>
</IfModule>
Added configs, tried to restart apache, gives an error:
Restarting apache2 (via systemctl): apache2.serviceJob for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details.
Failed!
The command systemctl status apache2.service
outputs:
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Drop-In: /lib/systemd/system/apache2.service.d
└─forking.conf
Active: failed (Result: exit-code) since Tue 2017-07-11 17:36:38 EEST; 2min 3s ago
Process: 1407 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Jul 11 17:36:38 web21 apache2[1407]: Starting web server: apache2 failed!
Jul 11 17:36:38 web21 apache2[1407]: The apache2 configtest failed. ... (warning).
Jul 11 17:36:38 web21 apache2[1407]: Output of config test was:
Jul 11 17:36:38 web21 apache2[1407]: AH00526: Syntax error on line 9 of /etc/apache2/sites-enabled/001-web8.teamgear.conf:
Jul 11 17:36:38 web21 apache2[1407]: Illegal override option #Deprecated
Jul 11 17:36:38 web21 apache2[1407]: Action 'configtest' failed.
Jul 11 17:36:38 web21 apache2[1407]: The Apache error log may have more information.
Jul 11 17:36:38 web21 systemd[1]: apache2.service: control process exited, code=exited status=1
Jul 11 17:36:38 web21 systemd[1]: Failed to start LSB: Apache2 web server.
Jul 11 17:36:38 web21 systemd[1]: Unit apache2.service entered failed state.
0
Author: Klimenko Kirill, 2017-07-11
1 answers
Try something like
<Directory "/var/www/example_site_directory">
AllowOverride All
Require all granted
</Directory>
In the host config. And then you have all the options commented out. This is if you have apache 2.4
2
Author: Ivan Bolnikh, 2017-07-11 14:32:25