我无法让 Vhost 在 centos 6.8 上托管多个 wordpress 网站

I cannot get Vhost to host multiple wordpress websites on centos 6.8

问题:我无法让网络服务器托管多个网站。

我尝试过的解决方案: 我为不同的网站制作了两个不同的 Vhost.conf(根据网站名称命名不同,但扩展名为 .conf。然后我将不同的文档根 link 定位到这些配置文件中的网站。 – 失败,显示“连接被拒绝”

然后我转到我创建的第二个网站目录并将文件权限更改为 755(和 777 以防万一)以检查是否存在冲突并产生问题,这也失败并出现相同的错误。 此外,所有文件都有“chown -R root:root dir/”。

然后我继续在iptables中打开端口8080并将第二个网站的虚拟主机中的目标端口更改为8080,这也失败了同样的错误。 我尝试使用“ip:8080,ip/secondwebsitedirectory,ip:80/secondwebsitedirectory”none 找到第二个网站。我按照多个在线教程的每一步进行操作,其中 none 个有效。

当我测试只是创建一个目录并在目录中的 index.php 中显示 <?php phpinfo; ?>,然后用第一个虚拟主机块的文档根目录定位它时,这有效但没有显示第二个块的网站(我使用域名 link 别名,并将域名转发到服务器 ip)。

我当前的 vhost.conf 文件如下所示 **注意:我应客户要求删除了 ip 和域。它们确实有效并且已经过测试,所以这不是问题。任何带有“testsite”的东西最初都是客户域。 ** 我之前已经将它设为两个单独的 VirtualHost 块,结果与我目前的结果相同,我在两个块上也有 <VirtualHost *:80>

<VirtualHost *>
        ServerAdmin webmaster@testsite.org
        ServerName ea
        ServerAlias *server ip was here*
        DocumentRoot /var/www/html/ea
        ErrorLog /var/www/html/ea/logs/error.log
        CustomLog /var/www/html/ea/logs/access.log combined


        ServerAdmin webmaster@testsite.org
        ServerName testsite
        ServerAlias www.testsite.co.uk 
        DocumentRoot /var/www/html/testsite/public_html
        ErrorLog /var/www/html/testsite/logs/error.log
        CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>

我想要的最终结果是能够在我的云服务器上托管多个站点,这些网站使用的是 Wordpress,因为这是我被指示使用的开发平台,服务器是 运行 Centos 6.8 安装了所有 php 和 apache2 并在一个网站上运行。 至于对此的结论,我很难过,需要你的帮助。

您需要为您想要的每个网站提供一份声明

<VirtualHost ea.mydomain.com:80>
        ServerAdmin webmaster@testsite.org
        ServerName ea.mydomain.com
        ServerAlias ea
        DocumentRoot /var/www/html/ea

        <Directory "/var/www/html/ea/">
            Options FollowSymLinks Indexes
            AllowOverride None
            # Use require all granted for apache 2.4
            Order allow,deny
            Allow from all
        </Directory>

        ErrorLog /var/www/html/ea/logs/error.log
        CustomLog /var/www/html/ea/logs/access.log combined
</VirtualHost>

<VirtualHost testsite.mydomain:80>
        ServerAdmin webmaster@testsite.org
        ServerName testsite.mydomain
        ServerAlias testsite.mydomain testsite
        DocumentRoot /var/www/html/testsite/public_html

        <Directory "/var/www/html/testsite/public_html">
            Options FollowSymLinks Indexes
            AllowOverride None
            # Use require all granted for apache 2.4
            Order allow,deny
            Allow from all
        </Directory>

        ErrorLog /var/www/html/testsite/logs/error.log
        CustomLog /var/www/html/testsite/logs/access.log combined
</VirtualHost>