【问题标题】:I cannot get Vhost to host multiple wordpress websites on centos 6.8我无法让 Vhost 在 centos 6.8 上托管多个 wordpress 网站
【发布时间】:2017-09-21 08:55:48
【问题描述】:

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

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

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

然后我继续在iptables中打开端口8080并将第二个网站的vhost中的目标端口更改为8080,这也失败并出现同样的错误。 我尝试使用“ip:8080, ip/secondwebsitedirectory, ip:80/secondwebsitedirectory”找到第二个网站,但这些都不起作用。我在网上遵循了多个教程的每一步,但这些都没有奏效。

当我测试只是创建一个目录并在目录内的 index.php 中显示<?php phpinfo; ?>,然后使用第一个虚拟主机块的文档根目录定位它,这有效但没有显示第二个块的网站(我使用域将别名链接到此并将域转发到服务器 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 在一个网站上安装并运行。 至于对此的结论,我很难过,需要你的帮助。

【问题讨论】:

    标签: wordpress apache centos httpd.conf vhosts


    【解决方案1】:

    每个网站都需要一个声明

    <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>
    

    【讨论】:

    • 上面的代码只是一个示例,您需要放置其余配置。我更新我的答案。发布日志消息
    • 最终通过域转发并将其与虚拟主机链接起来。非常感谢您的宝贵时间
    猜你喜欢
    • 2018-01-14
    • 1970-01-01
    • 2017-10-01
    • 1970-01-01
    • 2013-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-29
    相关资源
    最近更新 更多