为什么apache总是返回000-default而不是其他虚拟主机?

时间:2016-03-28 11:27:53

标签: apache virtual host

我尝试使用apache和虚拟主机在一台服务器上设置两个域。我为每个域创建了一个conf文件,但似乎apache总是使用000-default而不是我自己的conf文件。

这是我的目录结构:

a

我想我已经启用了两个域:

SELECT a.* FROM `TABLE1` a WHERE
(
  SELECT * FROM `TABLE2` b WHERE b.`PID` = 1
  AND
    (
    ( b.`CODE 1` NOT IN ('') AND IN (a.`CODE 1`,a.`CODE 2`, A.`CODE 3`...) ) OR
    ( b.`CODE 2` NOT IN ('') AND (a.`CODE 1`,a.`CODE 2`, A.`CODE 3`...) ) OR...

这是我自己的配置文件的内容:

world.getCities().get(cityID).getRequestsList()

我以root身份重启了apache(service apache2 reload)。 但无论哪个域,唯一显示的页面是/ var / www中的index.html。

这是/var/log/apache2/error.log的内容:

/var/www# ls -al
-rw-r--r-- 1 www-data www-data  236 Mär 11 16:21 .htaccess
-rw-r--r-- 1 root     root       43 Mär 28 05:22 index.html
drwxr-xr-x 5 www-data www-data 4096 Mär 28 05:02 domain-1.de
drwxr-xr-x 2 www-data www-data 4096 Mär 28 05:13 domain-2.de

2 个答案:

答案 0 :(得分:0)

我终于找到了解决方案。 在other_vhosts_access.log中有多个条目,如

[28/Mar/2016:09:50:11 -0500] "GET /index.html HTTP/1.1" 304 212 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"

Http返回代码304表示“未修改”,因此页面未再次传输。清除浏览器缓存后,一切都按预期工作。

THX!

答案 1 :(得分:0)

按照以下步骤

  1. sudo nano /etc/apache2/extra/httpd-vhosts.conf

bt_submit7.onclick ...
  1. 允许从Apache配置文件httpd.conf中进行vhosts配置

    sudo nano /etc/apache2/httpd.conf

搜索“虚拟主机”并取消注释包含行 虚拟主机 包括/private/etc/apache2/extra/httpd-vhosts.conf 这将允许使用http bt_submit7​.add​Event​Listener('click', function) d-vhosts.conf文件,打开该文件以添加到vhost中。

  1. sudo nano / etc / hosts

    127.0.0.1 website.localhost

  2. sudo apachectl重新启动

    您可以替换ErrorLog和CustomeLog或检查错误<VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerName website.localhost ServerAlias www.website.localhost # Index file and Document Root (where the public files are located) DirectoryIndex index.html index.php DocumentRoot "/Users/Username/Sites/website" # Log file locations LogLevel warn ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log" CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common <Directory /Users/Username/Sites/website> Options Includes FollowSymLinks AllowOverride All Order allow,deny Allow from all Require all granted </Directory> </VirtualHost> / private / var / log / apache2 /