我正在尝试将默认的 Apache 根位置更改/var/www/html
为/mnt/datos/mylocation
。我还尝试了 /home/[MY USER]/mylocation,认为它与已安装的分区权限有关。
- 我尝试使用
root:root
,www-data:www-data
并[MY USER]
作为/mnt/datos/mylocation
的所有者, - 我尝试了多个位置(因为我对权限有疑问)。
- 我创建了一个空的.htaccess 文件。
- 我甚至对所有东西都给出了 777(只是为了测试,我知道这很糟糕)。
- 站点在 Apache 配置中启用。
- Apache 已重新启动以应用更改。
当我加载localhost
或NNNNN.local
显示时:
Forbidden
You don't have permission to access this resource.Server unable to read htaccess file, denying access to be safe
Apache/2.4.52 (Ubuntu) Server at localhost Port 80
缺什么???
我当前的文件如下:
/etc/apache2/apache.conf
DefaultRuntimeDir ${APACHE_RUN_DIR}
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
/etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName NNNNN.local
ServerAlias NNNNN.local
DocumentRoot /mnt/datos/mylocation
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>