Apache 本地主机子域和通配符问题
我在xampp上安装了一个通配符vhost,在windows中的xampp上安装了一个通配符vhost,因为我想在localhost中测试一些应用,而不必为每个应用向vhosts.conf添加太多行。我认为这是最简单的方法,将以下内容添加到vhost.conf中:Apache 本地主机子域和通配符问题,apache,virtualhost,vhosts,Apache,Virtualhost,Vhosts,我在xampp上安装了一个通配符vhost,在windows中的xampp上安装了一个通配符vhost,因为我想在localhost中测试一些应用,而不必为每个应用向vhosts.conf添加太多行。我认为这是最简单的方法,将以下内容添加到vhost.conf中: <VirtualHost *:80> ServerAlias *.localhost VirtualDocumentRoot "C:/xampp/htdocs/%1/" </Virtual
<VirtualHost *:80>
ServerAlias *.localhost
VirtualDocumentRoot "C:/xampp/htdocs/%1/"
</VirtualHost>
<VirtualHost *:443>
ServerAlias *.localhost
VirtualDocumentRoot "C:/xampp/htdocs/%1/"
SSLEngine on
SSLCertificateFile "conf/ssl.crt/server.crt"
SSLCertificateKeyFile "conf/ssl.key/server.key"
<Directory "C:/xampp/htdocs/%1/">
AllowOverride All
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName johnny.localhost
ServerAlias johnny.localhost
DocumentRoot "C:/xampp/htdocs/heyjohnny/web"
<Directory "C:/xampp/htdocs/heyjohnny/web">
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
<Directory "C:/xampp/htdocs/heyjohnny/web/bundles">
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
</VirtualHost>`enter code here`
vhost服务器别名覆盖了后者,但我不知道如何覆盖前者,除非对其进行注释,并对我要添加的每一个vhost的键进行手动mash,这些键在一段时间后相加。我注意到它还覆盖了任何将http重定向到https的尝试。我可能会在本地主机上运行其中的一些东西,但我计划最终通过lan使用其中的一些。我尝试对条目重新排序,将通配符别名放在最后,但这并没有改变任何事情。我很可能做错了,但我愿意接受建议