原始的 httpd-vhosts.conf 配置文档如下:
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin 956736269@qq.com DocumentRoot "/data/webapps/test01" ServerName www.test01.com <Directory "/data/webapps/test01"> AllowOverride All Options Indexes FollowSymLinks Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin 956736269@qq.c0m DocumentRoot "/data/webapps/test02" ServerName www.test02.com <Directory "/data/webapps/test02"> AllowOverride All Options Indexes FollowSymLinks Order allow,deny Allow from all </Directory> </VirtualHost>然后报错:AH00548: NameVirtualHost has no effect and will be removed in the next release /usr/local/apache/conf/extra/httpd-vhosts.conf:1 原因是apache-2.4.x版本后的NameVirtualHost *:80这句已经多余,无需写入配置文档,删除即可
AH00526: Syntax error on line 3 of /usr/local/apache/conf/extra/httpd-vhosts.conf: Invalid command '\xc2\xa0', perhaps misspelled or defined by a module not included in the server configuration
\xc2\xa0:是一个叫做Non-breaking space的东西,用于阻止在此处自动换行和阻止多个空格被压缩成一个
是由于空格导致的问题,把空格修改一下就可以了
