Php 在Debian和Apache Multisite中配置主机

Php 在Debian和Apache Multisite中配置主机,php,apache,debian,virtualhost,hosts,Php,Apache,Debian,Virtualhost,Hosts,我正在尝试使用Apache和PHP-FPM配置Debian Jessie 8 VPS以服务于多站点 这是我的/etc/hosts文件 127.0.0.1 localhost 127.0.1.1 subdomain.mysite.com 127.0.1.1 site1.com # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet f

我正在尝试使用Apache和PHP-FPM配置Debian Jessie 8 VPS以服务于多站点

这是我的
/etc/hosts
文件

127.0.0.1 localhost
127.0.1.1 subdomain.mysite.com
127.0.1.1 site1.com
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
其中subdomain.mysite.com是我的主机名。site1.com是我的网站之一。 使用命令
sudo a2ensite site1.com.conf

我在
/var/www/site1.com/
中的Apache
VirtualHost
文件如下所示

<VirtualHost *:8080>
        ServerName  site1.com
        ServerAlias www.site1.com
        ServerAdmin myemail
        DocumentRoot /var/www/site1.com/web
        ErrorLog     /var/www/site1.com/logs/error.log
        CustomLog    /var/www/site1.com/logs/access.log combined
        <Directory "/var/www/site1.com/web">
                AllowOverride All
                Allow from all
        </Directory>
</VirtualHost>
如果我用我的服务器静态IP更改127.0.1.1,也不起作用

mystaticip site1.com site2.com
我需要帮助。
非常感谢。

以下主机文件为我提供了解决方案:

# /etc/hosts
127.0.0.1               localhost                       servername.yourdomain.com
# A.B.C.D stands for your IPv4 address
A.B.C.D                 servername.yourdomain.com       servername

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

我如何部署第二个域名?这就是DNS为您所做的。它将所有域名指向一个IP地址。您的Apache配置将每个域名发送到其各自的目录。
# /etc/hosts
127.0.0.1               localhost                       servername.yourdomain.com
# A.B.C.D stands for your IPv4 address
A.B.C.D                 servername.yourdomain.com       servername

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters