带有虚拟主机和通配符虚拟主机XAMPP v3.2.2的apache配置

时间:2018-12-04 17:09:07

标签: apache httpd.conf

我最近将Windows(32位)的XAMPP版本从5.6.38更新到了7.0.32。才能使用php 7。

升级XAMPP并删除旧文件后,我将httpd-dev.confvhost-server.conf文件添加到Apache的httpd.conf中,希望它可以正常工作,但会导致在localhost上找不到404对象,但可以正常运行其余对象。

我在名为f:/Server/的文件夹中安装了XAMPP,并且将localhost设置为默认安装f:/Server/htdocs/,并且一切正常,并且按照XAMPP的正常安装。

当我随后包含指向名为f:/www/f:/www2/的文件夹的dev和vhost文件时

这是运行www文件夹以动态服务域的dev文件

 # httpd-dev.conf
<Directory "F:/www/">
 AllowOverride All
 Order allow,deny
 Allow from all
 Require all granted
 </directory>

<Virtualhost *:80>
VirtualDocumentRoot "F:/www/%-2+/htdocs"
ServerName localhost
ServerAlias *.net
ErrorLog "logs/devserv-error.log"
CustomLog "logs/devserv-access.log" combined
SetEnv DB_USERNAME *******
SetEnv DB_PASSWORD *******
SetEnv ENVIRONMENT DEV
<Directory "F:/www/*/htdocs/">
     Options Indexes FollowSymLinks Includes ExecCGI
     AllowOverride All
     Order allow,deny
     Allow from all
     Require all granted
 </Directory>
 </Virtualhost>

<VirtualHost *:443> 
ServerName localhost
ServerAlias *.net
ErrorLog "logs/devserv-error.log"
CustomLog "logs/devserv-access.log" combined
VirtualDocumentRoot F:/www/%-2+/htdocs

<Directory "F:/www/*/htdocs/">
     Options Indexes FollowSymLinks Includes ExecCGI
     AllowOverride All
     Order allow,deny
     Allow from all
     Require all granted
 </Directory> 

SSLEngine on  
SSLCertificateFile conf/ssl.crt/server.crt  
SSLCertificateKeyFile conf/ssl.key/server.key 
</VirtualHost>

这是运行www2文件夹作为直接虚拟主机的vhost文件

 # vhost-server.conf
 <Directory "F:/www2/">
 AllowOverride All
 Order allow,deny
 Allow from all
 Require all granted
</directory>

<VirtualHost *:80>
ServerName www.somedomain.net
ServerAlias somedomain.net
ServerAdmin admin@somedomain.net
DocumentRoot "F:/www2/somedomain.net/htdocs"
ErrorLog "F:/www2/somedomain.net/logs/error.log"
CustomLog "F:/www2/somedomain.net/logs/access.log" combined
SetEnv DB_USERNAME *******
SetEnv DB_PASSWORD *******
SetEnv ENVIRONMENT STAGE
<Directory "F:/www2/somedomain.net/htdocs/">
 Options Indexes FollowSymLinks Includes ExecCGI
 AllowOverride All
 Order allow,deny
 Allow from all 
 Require all granted
</directory>
</VirtualHost>

当这些文件包含在Apache httpd文件localhost中时,仅会错误显示localhost / dashboard的别名,而localhost / phpmyadmin仍然有效,但localhost不起作用。有人可以帮我弄清楚为什么会这样吗。

在旁注中,还有一种方法可以动态保存日志文件,因为我目前将它们全部放在一个位置,并且我想按dev虚拟主机查看它们

0 个答案:

没有答案