本帖最后由 loveyouhyf 于 2015-11-4 14:34 编辑
[root@mail ~]# /usr/local/apache/bin/apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
rewrite_module (shared) #此处明明有加载rewrite模块
php5_module (shared)
但是在编辑完vim /usr/local/apache/conf/extra/httpd-vhosts.conf 配置文件后,检查配置文件总是报错,
httpd-vhosts.conf 配置文件如下:
#第一个虚拟主机配置
DocumentRoot "/home/httpd/html1"
ServerName www.example.com
ErrorLog "logs/example-error_log"
CustomLog "logs/example-access_log" common
#用户认证模块
AllowOverride AuthConfig
AuthName "please enter the password"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
# #限制任何访问/home/httpd/html1目录
#Order allow,deny
#Deny from all
# #第二个虚拟主机配置
DocumentRoot "/home/httpd/html2"
ServerName www.example1.com
#域名301跳转模块
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example1.com$
RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L]
报错信息如下:
[root@mail ~]# /usr/local/apache/bin/apachectl -t
httpd: Syntax error on line 470 of /usr/local/apache/conf/httpd.conf: Syntax error on line 46 of /usr/local/apache/conf/extra/httpd-vhosts.conf:
[root@mail ~]# /usr/local/apache/bin/apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
rewrite_module (shared) #此处明明有加载rewrite模块
php5_module (shared)
但是在编辑完vim /usr/local/apache/conf/extra/httpd-vhosts.conf 配置文件后,检查配置文件总是报错,
httpd-vhosts.conf 配置文件如下:
#第一个虚拟主机配置
DocumentRoot "/home/httpd/html1"
ServerName www.example.com
ErrorLog "logs/example-error_log"
CustomLog "logs/example-access_log" common
#用户认证模块
AllowOverride AuthConfig
AuthName "please enter the password"
AuthType Basic
AuthUserFile /data/.htpasswd
require valid-user
# #限制任何访问/home/httpd/html1目录
#Order allow,deny
#Deny from all
# #第二个虚拟主机配置
DocumentRoot "/home/httpd/html2"
ServerName www.example1.com
#域名301跳转模块
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example1.com$
RewriteRule ^/(.*)$ http://www.example.com/$1 [R=301,L]
报错信息如下:
[root@mail ~]# /usr/local/apache/bin/apachectl -t
httpd: Syntax error on line 470 of /usr/local/apache/conf/httpd.conf: Syntax error on line 46 of /usr/local/apache/conf/extra/httpd-vhosts.conf:
编辑回复