简体   繁体   English

centos httpd.conf多个子域不同的位置

[英]centos httpd.conf multiple subdomain different location

This has probably been answered but I can't find a straight answer, or the ones I found don't work. 这可能已经回答了,但是我找不到直接的答案,或者我发现的答案不起作用。

I have one domain, let's call it mydomain.com The DNS settings point two subdomains. 我有一个域,我们称它为mydomain.com DNS设置指向两个子域。 These are staging.mydomain.com and mydomain.com. 这些是staging.mydomain.com和mydomain.com。 Both have an A-record pointing to same IP, lets say 8.8.8.8. 两者都有指向相同IP的A记录,比方说8.8.8.8。

On the server (8.8.8.8) I have httpd.conf with two virtual hosts, which already create by cpanel. 在服务器(8.8.8.8)上,我有两个虚拟主机的httpd.conf,它们已经由cpanel创建。 These are as follows: 这些如下:

mydomain.com mydomain.com

<VirtualHost 8.8.8.8:80>
    ServerName mydomain.com
    ServerAlias www.mydomain.com
    DocumentRoot /home/userxxx/public_html

    ## User ydg015 # Needed for Cpanel::ApacheConf
    <IfModule mod_suphp.c>
        suPHP_UserGroup userxxx userxxx
    </IfModule>
    <IfModule !mod_disable_suexec.c>
        <IfModule !mod_ruid2.c>
           SuexecUserGroup userxxx userxxx
        </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
       RUidGid userxxx userxxx
    </IfModule>
    CustomLog /usr/local/apache/domlogs/mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
    CustomLog /usr/local/apache/domlogs/mydomain.com combined
    # ScriptAlias /cgi-bin/ /home/userxxx/public_html/cgi-bin/
</VirtualHost>

And... 和...

staging.mydomain.com staging.mydomain.com

 <VirtualHost 8.8.8.8:80>
        ServerName staging.mydomain.com
        ServerAlias *.staging.mydomain.com
        DocumentRoot /home/userxxx/public_html/staging

        UseCanonicalName Off
        CustomLog /usr/local/apache/domlogs/staging.mydomain.com combined
        CustomLog /usr/local/apache/domlogs/staging.mydomain.com-bytes_log "%{%s}t %I .\n%{%s}t %O ."
        ## User ydg015 # Needed for Cpanel::ApacheConf
        <IfModule mod_suphp.c>
            suPHP_UserGroup userxxx userxxx
        </IfModule>
        <IfModule !mod_disable_suexec.c>
            <IfModule !mod_ruid2.c>
                SuexecUserGroup userxxx userxxx
            </IfModule>
        </IfModule>
        <IfModule mod_ruid2.c>
            RUidGid userxxx userxxx
        </IfModule>
       # ScriptAlias /cgi-bin/ /home/userxxx/public_html/staging/cgi-bin/


        # To customize this VirtualHost use an include file at the following location
        # Include "/usr/local/apache/conf/userdata/std/2/userxxx/staging.mydomain.com/*.conf"

    </VirtualHost>

The problem is: 问题是:

I'm using wordpress multiple site to build both site (staging and main), and the multisite provide another subdomain like http://en.mydomain.com and http://en.staging.mydomain.com 我正在使用wordpress多个站点来构建两个站点(临时站点和主要站点),并且该多站点提供了另一个子域,例如http://en.mydomain.comhttp://en.staging.mydomain.com

Everytime I go to en.mydomain.com or en.staging.mydomain.com, I always land on "cgi-sys/defaultwebpage.cgi" someone told me, maybe I should make a change on the http.conf, but I don't know what should I change. 每次我访问en.mydomain.com或en.staging.mydomain.com时,我总是登录有人告诉我的“ cgi-sys / defaultwebpage.cgi”,也许我应该对http.conf进行更改,但是我不这样做不知道我应该改变什么。

can anybody help me to fix this? 有人可以帮我解决这个问题吗?

Any suggestions would be so appreciated. 任何建议将不胜感激。 Thanks you! 谢谢!

The code given in these two virtual hosts are fine, but there could be another configuration in which might causing this behavior. 这两个虚拟主机中给出的代码很好,但是可能存在另一种配置可能导致这种现象。 You should use following command to identify the correct document root. 您应该使用以下命令来标识正确的文档根目录。

httpd -t -D DUMP_VHOSTS

Note: httpd needs to be replaced with correct executable for your environment, for example apache2 or apachectl 注意: httpd需要替换为适合您的环境的可执行文件,例如apache2或apachectl

Share the output of this command in case if you still not able to understand the issue. 如果您仍然无法理解问题,请共享此命令的输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM