花了两个小时,一直在重复,最后想放弃的时候瞥见了一句英文。。。
环境:1、ubuntu18
2、apache2
1、在/etc/apache2/apache2.conf中
有这么一段代码
# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www. # 看见这句话没有 //这句话说以下设置禁止了其他的根目录
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
2、所以我把 Require all denied
给注释掉,即前面加上了#
(注:有没有人能否告诉我这样做是否会对服务器造成不可知问题)
3、然后修改/etc/apache2/sites-available/000-default.vonf
ServerAdmin webmaster@localhost
DocumentRoot /home/smith/Data/php # 这里,初始是/var/www/html, 修改你要设置的文件目录
4、现在csdn好水阿,,,,早知道还不如上stackflow上查呢,只是对自己的英语不自信
5、哦哦哦,不要忘记在你设置的目录下,建立一个index.html文件