所以,这个问题看起来很简单,但我很不幸地试图解决这个问题,但没有结果。Apache仍然没有看到"/web“目录(例如,我无法加载那里存在的css样式或图像)。下面是我的httpd-vhosts.conf:
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\wamp64\www\projekt2\web"
ServerName projekt2.dev
ServerAlias projekt2.dev www.projekt2.dev
Options Indexes FollowSymLinks
<Directory "C:\wamp64\www\projekt2\web">
# AllowOverride All
# Order Allow,Deny
# Allow from All
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
Allow from all
</Directory>
</VirtualHost>以及Windows目录中的hosts.conf:
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host
# localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
# ::1 localhost
127.0.0.1 projekt2.dev
::1 projekt2.dev有人知道怎么解决这个问题吗?我会非常感激的。
发布于 2016-11-16 07:05:42
我只想确定-你看不到哪个虚拟主机?ServerName本地主机还是ServerName本地主机?
我看到您在Windows上运行Apache,所以我不确定这些命令行开关是否能工作,因为我在linux上将它们用于apache。
/usr/local/apache2/bin/httpd -S
它将输出Apache如何解析配置文件的描述。仔细检查可能有助于发现配置错误。
httpd -t
只对配置文件运行语法测试。
权限在这里也可以发挥很大作用。apache服务(守护进程)帐户是否有权访问不可访问文件的位置?
https://serverfault.com/questions/815129
复制相似问题