当httpdredirect到位时,Xampp虚拟主机文件混乱

下面是我的Windows 7机器上运行xampp 1.7.4的参考的httpd-vhosts.conf文件:

<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot C:/xampp/htdocs ServerName localhost ServerAlias localhost <Directory "C:/xampp/htdocs"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@new_site DocumentRoot C:/xampp/htdocs/new_site ServerName new_site ServerAlias new_site <Directory "C:/xampp/htdocs/new_site"> Options Indexes FollowSymLinks Includes ExecCGI AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost> 

我什至不能猜测为什么,但在任何本地主机目录(即使https:// localhost / new_site工作正常)运行HTTPS但运行HTTPS:// new_site产生404错误。

我知道端口443通常在httpsredirect中使用,但将其添加到虚拟主机configuration文件会导致apache停止运行。 另外,在同一个文件中从来没有为本地主机定义443端口,所以我认为这是不必要的。

Apache对这个configuration很满意,但是你的DNS …并不是那么多。 你需要告诉你的电脑,你不仅是localhost而且是new_site

您可以通过编辑位于%systemroot%\system32\drivers\etc\hosts hosts文件来执行此操作。 添加这一行:

 127.0.0.1 new_site 

或者,如果您正在运行一个DNS,请将新的Alogging添加到您的DNS。

为了使https工作,您需要将您的站点添加到ssl.confhttpd-ssl.conf ,您的localhost应在此处定义。