设置多个文档根apache2(服务器端(非本地))

时间:2014-08-28 17:42:55

标签: apache virtualhost

我正在尝试在DocumentRoot中设置两个单独的httpd.conf

我有以下内容:

     NameVirtualHost 89.104.220.210
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/system.dk/html/
    ServerName  system.dk
    ErrorLog /logs/system
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost 89.104.220.210>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/system.dk/html/system/
    ServerName  system.org
    ErrorLog /logs/system
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

但是当我尝试重新启动时,它无法启动:

    Stopping httpd:                                            [FAILED]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 89.104.220.207 for ServerName
                                                           [FAILED]

有人可以帮助我吗?

更新

我现在有以下内容:

     NameVirtualHost 89.104.220.207:80
 NameVirtualHost 89.104.220.207:1500
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
<VirtualHost 89.104.220.207:80>
     ServerAdmin webmaster@example.com
     DocumentRoot /var/www/system.dk/html
     ServerName www.system.dk
     ServerAlias system.dk
     ErrorLog /var/www/learnbypower.dk/logs/error_log


</VirtualHost>
<VirtualHost 89.104.220.207:1500>
     ServerAdmin webmaster@example.org
     DocumentRoot /var/www/system/
     ServerName system
     ServerAlias system.dk
     ErrorLog /var/www/system.dk/logs/error_log

</VirtualHost>

1 个答案:

答案 0 :(得分:1)

使用以下命令检查它显示的错误。

httpd -t

Apache Error也会在失败时记录。默认路径是。

/var/log/httpd/error_log