Alias指令可能永远不会匹配,因为它与早期的Alias重叠

时间:2015-01-16 07:08:25

标签: php apache localhost cgi

我正在尝试在我的localhost服务器上运行cgi 首先,我添加了虚拟本地主机 我有conf文件/etc/apache2/sites-available/myage.com.conf 这是此文件的内容。

<VirtualHost *:80>
        ServerName mypage.com
        ServerAlias www.mypage.com
        ServerAdmin admin@mypage.com
        DocumentRoot /var/www/mypage.com/public_html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
ScriptAlias /cgi-bin/ /var/www/mypage.com/cgi-bin/
<Directory "/var/www/mypage.com/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
</Directory>

我在重启apache2服务时遇到错误

 [Fri Jan 16 09:06:12.422793 2015] [alias:warn] [pid 12733] AH00671: The ScriptAlias directive in /etc/apache2/sites-enabled/mypage.com.conf at line 31 will probably never match because it overlaps an earlier ScriptAlias.

1 个答案:

答案 0 :(得分:4)

将您已声明的ScriptAlias<Directory>...</Directory>指令放在VirtualHost标记块的中;您上面的文件当前已将它们声明为服务器范围,因为它们在它之外。

ScriptAlias重叠警告是由于Apache启动时在配置文件中早先已在服务器范围内声明ScriptAlias /cgi-bin/引起的。