我search了很多关于这方面的许多信息,但没有提出的解决scheme没有帮助我。
我拥有的:
rhel7系统 apache 2.4 /var/www/domain.com/public_html /var/www/domain.com/publik_html/src => /home/user/src /home/user/src我有一些文本index.html 我的apache VHconfiguration( /etc/httpd/sites-available/domain.com.conf ):
<VirtualHost *:80> ServerName www.domain.com ServerAlias domain.com DocumentRoot /var/www/domain.com/public_html <Directory /var/www/domain.com/public_html> Options Indexes FollowSymLinks Require all granted AllowOverride All </Directory> </VirtualHost>
在Apache主configuration中的一些感兴趣的部分:
# # Deny access to the entirety of your server's filesystem. You must # explicitly permit access to web content directories in other # <Directory> blocks below. # <Directory /> AllowOverride none Require all denied </Directory> # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/var/www/html" # # Relax access to content within /var/www. # <Directory "/var/www"> Options Indexes FollowSymLinks AllowOverride None # Allow open access: Require all granted </Directory> # Further relax access to the default document root: <Directory "/var/www/html"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride None # # Controls who can get stuff from this server. # Require all granted </Directory>
问题:当我尝试访问domain.com/src/index.html我得到了禁止。
我试试:
chmod o+x /home /home/user /home/user/src /home/user/src/index.html chown -R apache:apache /var/www/ chown -R apache:apache /home/user/src/ FollowSymLinks和SymLinksIfOwnerMatch游戏 chmod游戏 我还有什么可以尝试? 谢谢…
UPD#1:禁用SElinux
如果你使用基于rhel7的系统(centos,fedora等),你默认启用了SElinux。 在我的做法95%的问题是selinuxconfiguration不匹配,我认为你的Apacheconfiguration是正确的。 请以root权限执行:
# getenfore
与残疾selinux模式输出将是,所以问题是不是。 输出:
disabled
如果输出将是Permissive或Enforce。 只是改变testingSELinux模式,通过getenforcevalidation它改变了:
# setenforce 0 # getenfore
尝试使用您的apache服务器再尝试一次http查询(尝试使用您的浏览器和地址example.com加载页面)。 如果这个解决scheme有助于写在这里。 所有解决scheme只在顶部写入,以便find问题所在,请不要在生产服务器上使用此更改。 请不要禁用SELinux,因为它做很多pipe理员,这是不安全的。 如果第一部分生效,我会写第二部分的命令来启用SELinux权限。
啊,只是在x文件夹权限的问题。 对不起,感谢您的帮助!
此外,这也帮助我: https : //askubuntu.com/questions/537032/how-to-configure-apache2-with-symbolic-links-in-var-www