修改000-default.conf时Apache2关闭

时间:2018-03-06 15:45:06

标签: apache file configuration

当我按照安装应用程序maarchrm的指南进行操作时。它要求在配置文件中包含以下行' 000-default.conf' :

# Application Maarch RM 
     Include /var/www/laabs/data/maarchRM/conf/vhost.conf

但是当我把它放入配置文件中时;我不能再重启apache了。只有当我删除我添加到文件' 000-default.conf'。

的行时,我才能重新启动apache。

这是000-default.conf文件的代码:

    <VirtualHost *:80>
    # The ServerName directive sets the request scheme, hostname and port that
    # the server uses to identify itself. This is used when creating
    # redirection URLs. In the context of virtual hosts, the ServerName
    # specifies what hostname must appear in the request's Host: header to
    # match this virtual host. For the default virtual host (this file) this
    # value is not decisive as it is used as a last resort host regardless.
    # However, you must set it for any further virtual host explicitly.
    #ServerName www.example.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
    # error, crit, alert, emerg.
    # It is also possible to configure the loglevel for particular
    # modules, e.g.
    # LogLevel info ssl:warn

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    # For most configuration files from conf-available/, which are
    # enabled or disabled at a global level, it is possible to
    # include a line for only one particular virtual host. For example the
    # following line enables the CGI configuration for this host only
    # after it has been globally disabled with "a2disconf".
    # Include conf-available/serve-cgi-bin.conf
    # Application Maarch RM 
     Include /var/www/laabs/data/maarchRM/conf/vhost.conf

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

vhost.conf:

    # APP MaarchRM - Records Management
<VirtualHost *:80>

    # Chemin vers le répertoire public web de Laabs
     DocumentRoot /var/www/laabs/web/

    # Nom du vhost (identique au nom associé à l'adresse IP dans le fichier host)
     ServerName maarchrm

    Options -Indexes 
    Options FollowSymLinks

    # DirectoryIndex dynamic.php

    # Rewrite URLs to route to frontal scripts 
    # when target is not an existing public resource
    RewriteEngine On

    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_URI} ^/public [NC]
    RewriteRule .* - [QSA,L]

    # Rewrite to dynamic frontal if no file extension
    # input: /route?args... 
    # output : http.php/route?args...
    RewriteRule ^(.*)$ /http.php [QSA,L] 

    # Set environment variables for the application instance
    SetEnv LAABS_INSTANCE_NAME maarchRM
    SetEnv LAABS_APP maarchRM
    SetEnv LAABS_BUNDLES recordsManagement;documentManagement;digitalResource;medona;financialRecords;organization;audit;lifeCycle;archivesPubliques;contact;seda;auth;businessRecords
    # SetEnv LAABS_EXTENSIONS
    SetEnv LAABS_DEPENDENCIES repository;xml;html;localisation;datasource;sdo;json;fileSystem;authentication;logger;authorization
    SetEnv LAABS_PRESENTATION maarchRM

    SetEnv LAABS_CONFIGURATION "../data/maarchRM/conf/configuration.ini"
    SetEnv LAABS_LOG "../data/maarchRM/log.txt"
    SetEnv LAABS_TMP_DIR "../data/maarchRM/tmp"

    SetEnv LAABS_CONTENT_TYPES "url:application/x-www-form-urlencoded;html:text/html,application/xhtml+xml;xml:application/xml;json:application/json,application/javascript;soap:application/soap+xml;csv:text/csv"
    #SetEnv LAABS_CONTENT_LANGUAGES "fr:fr,fr-fr,fr-ca"
    SetEnv LAABS_CACHE_CONTROL "public, max-age=3600"

    #SetEnv LAABS_EXCEPTION_HANDLER
    #SetEnv LAABS_ERROR_HANDLER

    SetEnv LAABS_DATE_FORMAT "d-m-Y"
    SetEnv LAABS_TIMESTAMP_FORMAT "Y-m-d\TH:i:s,u\Z"
    SetEnv LAABS_NUMBER_DECIMALS 2
    SetEnv LAABS_DEFAULT_URI recordsManagement/welcome/welcomePage
    SetEnv LAABS_ERROR_URI recordsManagement/welcome/error

    SetEnv LAABS_CRYPT_KEY mySecretKey
    SetEnv LAABS_CRYPT_CIPHER MCRYPT_BLOWFISH
    SetEnv LAABS_XML_NS "seda:fr:gouv:culture:archivesdefrance:seda:v1.0;medona:org:afnor:medona:1.0"
</VirtualHost>

我希望你能解决这个问题。 提前谢谢

1 个答案:

答案 0 :(得分:1)

在default.conf中注释这些行

   ServerAdmin webmaster@localhost 
   DocumentRoot /var/www/html 

   ErrorLog ${APACHE_LOG_DIR}/error.log 
   CustomLog ${APACHE_LOG_DIR}/access.log combined

在每行之前放置#

#ServerAdmin webmaster@localhost 
#DocumentRoot /var/www/html 

#ErrorLog ${APACHE_LOG_DIR}/error.log 
#CustomLog ${APACHE_LOG_DIR}/access.log combined

然后再次重启你的apache。这应该可以解决问题

控制你的000-default.conf是否如此(代码在完全相同的位置)。

<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

#ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
# LogLevel info ssl:warn

#ErrorLog ${APACHE_LOG_DIR}/error.log
#CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
# Include conf-available/serve-cgi-bin.conf
# Application Maarch RM 

<Directory />
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
    Allow from all
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Include /var/www/laabs/data/maarchRM/conf/vhost.conf
相关问题