国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > Apache > 正文

apache documentroot指向htcdoc之外提示403錯誤的解決方法

2024-08-27 18:26:58
字體:
來源:轉載
供稿:網友
后來發現,原來又是Apache沒配置 好,是apache的mod_authz_host模塊在起控制作用。
1.如果不啟用vhosts
只需修改 httpd.conf
默認Directory節如下,注意紅色部分,表示目錄/usr/local/apache/htdocs允許所有 主機訪問
復制代碼 代碼如下:

<Directory "/usr/local/apache/htdocs">
#
# 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.2/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.
#
Order allow,deny
Allow from all
</Directory>

由于主目錄被指到別的地方了,所以將藍色部分/usr/local/apache/htdocs換成你新的主目錄就OK了。
2.啟用vhosts
啟 用vhosts的話,你就可以不作上面的修改了,因為VirtualHost可以單獨配置這個節的屬性,所以我們在VirtualHost這個節里配置的 話就更方便了,下面的配置中,我把我的網站放在/var/vhosts/www.test.cn下。
復制代碼 代碼如下:

/usr/local/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
<Directory "/var/vhosts/www.test.cn" >
#Deny from all
Allow from all
</Directory>
DocumentRoot "/var/vhosts/www.test.cn"
ServerName www.test.cn
</VirtualHost>

如果把Deny from all的注釋去掉,那么服務器就會拒絕所有訪問(和我們剛開始把主目錄移動到htdocs外而沒做任何配置修改時一樣,哈哈)
補充一點:
如果你是寫個index.php放在目錄下測試,可要注意了,記得加上默認主頁index.php
DirectoryIndex index.html index.php

您可能感興趣的文章:

關于Apache默認編碼錯誤 導致網站亂碼的解決方案apache2.2和php5.2.17在windows下整合過程的錯誤解決方法Apache訪問出現501 Method Not Implemented錯誤解決
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 色达县| 容城县| 新沂市| 丰镇市| 巴南区| 闸北区| 陵水| 饶河县| 察哈| 丘北县| 济阳县| 桑日县| 若尔盖县| 华宁县| 湘乡市| 武功县| 兴安县| 图们市| 宁明县| 黎川县| 正阳县| 潮安县| 昌平区| 宁南县| 沂源县| 仙居县| 伽师县| 岑巩县| 河曲县| 喀什市| 民权县| 长宁县| 西安市| 崇文区| 汉源县| 汶上县| 平利县| 谷城县| 江都市| 邛崃市| 衡东县|