<virtualhost>不能出现在<virtualhost>部分</virtualhost> </virtualhost>中

时间:2013-11-28 09:58:22

标签: virtualhost plesk vhosts

在我尝试使用自己的vhost.confic而不是使用Plesk生成的文件后,我只需复制last_httpd.include文件并进行一些修改 - 更改文档根目录。但是 / usr / local / psa / admin / sbin / httpdmng --reconfigure-domain redmine.newslab.cz 得到了一些错误

2013-11-28T10:52:28+01:00 ERR (3): Apache config (13856323480.31924600) generation failed: Syntax error on line 1 of /var/www/vhosts/redmine.newslab.cz/conf/vhost.conf:
<VirtualHost> cannot occur within <VirtualHost> section

Syntax error on line 1 of /var/www/vhosts/redmine.newslab.cz/conf/vhost.conf:
<VirtualHost> cannot occur within <VirtualHost> section

vhost.conf文件

<VirtualHost *:80 >
    ServerName "redmine.newslab.cz"
        ServerAlias  "www.redmine.newslab.cz"
        ServerAlias  "ipv4.redmine.newslab.cz"
        UseCanonicalName Off


<IfModule mod_suexec.c>
    SuexecUserGroup "redmine.newslab" "psacln"
</IfModule>

    ServerAdmin  "admin@newslab.cz"

    DocumentRoot "/var/www/vhosts/redmine.newslab.cz/httpdocs/redmine/public"
    CustomLog /var/www/vhosts/redmine.newslab.cz/statistics/logs/access_log plesklog
    ErrorLog  "/var/www/vhosts/redmine.newslab.cz/statistics/logs/error_log"


<IfModule mod_userdir.c>
    UserDir "/var/www/vhosts/redmine.newslab.cz/web_users"
</IfModule>

    ScriptAlias  "/cgi-bin/" "/var/www/vhosts/redmine.newslab.cz/cgi-bin/"


    Redirect permanent /plesk-stat https://redmine.newslab.cz/plesk-stat
    Redirect permanent /webstat https://redmine.newslab.cz/webstat
    Redirect permanent /webstat-ssl https://redmine.newslab.cz/webstat-ssl
    Redirect permanent /ftpstat https://redmine.newslab.cz/ftpstat
    Redirect permanent /anon_ftpstat https://redmine.newslab.cz/anon_ftpstat
    Redirect permanent /awstats-icon https://redmine.newslab.cz/awstats-icon


    <IfModule mod_ssl.c>
        SSLEngine off
    </IfModule>

SetEnv PP_CUSTOM_PHP_INI /var/www/vhosts/redmine.newslab.cz/etc/php.ini

<IfModule mod_fcgid.c>
    FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/redmine.newslab.cz/etc/php.ini
    FcgidMaxRequestLen 16777216
</IfModule>

    <Directory /var/www/vhosts/redmine.newslab.cz/httpdocs/redmine/public>

<IfModule mod_perl.c>
    <Files ~ (\.pl$)>
        SetHandler perl-script
        PerlHandler ModPerl::Registry
        Options ExecCGI
        allow from all
        PerlSendHeader On
    </Files>
</IfModule>
<IfModule mod_python.c>
    <Files ~ (\.py$)>
        SetHandler python-program
        PythonHandler mod_python.cgihandler
    </Files>
</IfModule>
<IfModule mod_fcgid.c>
    <Files ~ (\.fcgi)>
        SetHandler fcgid-script
        Options +FollowSymLinks +ExecCGI
    </Files>
</IfModule>
<IfModule mod_fcgid.c>
    <Files ~ (\.php)>
        SetHandler fcgid-script
        FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
        Options +ExecCGI
        allow from all
    </Files>
</IfModule>

        Options -Includes +ExecCGI

    </Directory>

<Directory "/var/www/vhosts/redmine.newslab.cz/statistics">
    AuthType Basic
    AuthName "Domain statistics"
    AuthUserFile "/var/www/vhosts/redmine.newslab.cz/pd/d..httpdocs@plesk-stat"
    require  valid-user
</Directory>
Alias /error_docs /var/www/vhosts/redmine.newslab.cz/error_docs
ErrorDocument 400 /error_docs/bad_request.html
ErrorDocument 401 /error_docs/unauthorized.html
ErrorDocument 403 /error_docs/forbidden.html
ErrorDocument 404 /error_docs/not_found.html
ErrorDocument 500 /error_docs/internal_server_error.html
ErrorDocument 405 /error_docs/method_not_allowed.html
ErrorDocument 406 /error_docs/not_acceptable.html
ErrorDocument 407 /error_docs/proxy_authentication_required.html
ErrorDocument 412 /error_docs/precondition_failed.html
ErrorDocument 414 /error_docs/request_uri_too_long.html
ErrorDocument 415 /error_docs/unsupported_media_type.html
ErrorDocument 501 /error_docs/not_implemented.html
ErrorDocument 502 /error_docs/bad_gateway.html
ErrorDocument 503 /error_docs/maintenance.html

</VirtualHost>

有没有人知道出了什么问题。 THX

1 个答案:

答案 0 :(得分:3)

很简单。您的vhost.conf包含在里面由Plesk生成的内容,它不会取代Plesk配置。这意味着您需要从vhost.conf指令和其他重复内容中删除VirtualHost。只保留您需要的指令以及Plesk不会自行添加的指令。