httpd-vhosts.conf 的配置文件:
<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs\lsapp\public"
ServerName lsapp.test
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\Apache24\htdocs\codeigniter\bladetemplate\public"
ServerName bladetemplate.test
</VirtualHost>
httpd-conf 文件
ServerRoot "c:/Apache24"
Listen 80
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>
ServerAdmin [email protected]
ServerName localhost
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "c:/Apache24/htdocs/lsapp/public"
<Directory "c:/Apache24/htdocs/lsapp/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error.log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access.log" common
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "c:/Apache24/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule headers_module>
RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
LoadModule php5_module "c:/php/php5apache2_4.dll"
<IfModule php5_module>
PHPIniDir "C:/php"
AddHandler application/x-httpd-php .php
</IfModule>
这是window系统的hosts文件:
127.0.0.1 localhost
127.0.0.1 lsapp.test
127.0.0.2 bladetemplate.test
当我打开浏览器时,写入 bladetemplate.test 主机。它会获取 lsapp.test 数据。我无法弄清楚哪里出了问题,请查看上面的 conf 文件。我的所有 ServerName 和 DocumentRoot 都是正确的。我正在开发 laravel 应用程序。我已经正确检查了我的文件和文件夹。
答案1
你是不是忘记了<Directory>
bladetemplate.test 的指令?尝试添加这个:
<Directory "C:\Apache24\htdocs\codeigniter\bladetemplate\public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>