修改apache的網站根目錄


花了兩個小時,一直在重復,最后想放棄的時候瞥見了一句英文。。。

環境: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好水阿,,,,早知道還不如上stackoverflow上查呢,只是對自己的英語不自信

5、哦哦哦,不要忘記在你設置的目錄下,建立一個index.html文件


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM