已配置FollowSymLinks但Apache无法通过符号链接提供用户文件的问题求助
已配置FollowSymLinks但Apache无法通过符号链接提供用户文件的问题求助
大家好,我最近碰到个Apache符号链接的棘手问题,想请教下社区的朋友们。
我的开发环境是Ubuntu 24.04,Apache以www-data用户身份运行,服务器根目录设置为/var/www/html。下面是我的Apache配置内容:
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 FollowSymLinks AllowOverride None Require all denied </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
我已经在/var/www/的目录配置里明确开启了FollowSymLinks选项,但尝试通过符号链接访问用户个人目录(比如/home/user/docs)下的文件时,Apache总是返回403禁止访问或者文件未找到的错误。我检查过符号链接本身的权限,也确认了目标目录的权限设置,但问题依然没解决。
有没有朋友遇到过类似的情况?或者能帮我排查下可能的问题点?
备注:内容来源于stack exchange,提问作者Mark
相关产品推荐
相关产品推荐

