簡體   English   中英

如何將舊的配置文件從 Apache 2.2.22 轉移到 Apache 2.4.6

[英]How to transfer old configuration files from Apache 2.2.22 to Apache 2.4.6

我是 Apache 的新手,當我將 apache 從 2.2.22 更新到 2.4.6 時,我發現用於放置 mod_rewrite 設置的默認虛擬主機位置已更改。

對於 apache2.2.22:它在 /etc/apache2/sites_enabled/default 中。 對於 apache 2.4.6,它發生了變化,幫助文檔也說:“NameVirtualHost directiveAs”:不再需要,現在已棄用。

我注意到該設置似乎已從 apache.conf 中刪除。 這是我對 Apache 2.2.22 和 2.4.6 的配置詳細信息。

誰能告訴我我需要在配置中更改什么?

對於 apache2.2.22:/etc/apache2/sites_enabled/default

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride all
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128

<Location />
   AuthName "CIO Internal Demo"
   AuthType Basic
   AuthUserFile /etc/apache2/htpasswd.users
   Require valid-user
</Location>

<Location /liveclass_api/liveclass_callback.php>
    Satisfy Any
    Allow from all
</Location>

<Location /sp_service.php>
    Satisfy Any
    Allow from all
</Location>

                                                                                   1,1           Top

對於 apache2.4.6:/etc/apache2/sites_enabled/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
    # 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
</VirtualHost>

vim: 語法=apache ts=4 sw=4 sts=4 sr noet

Apache 2.4.6 文件 apache.conf 的一部分

# Include list of ports to listen on
Include ports.conf
# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

<Directory /usr/share>
    AllowOverride None
    Require all granted
</Directory>

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

您所談論的文件和目錄看起來就像您在 debian linux 上一樣,因為原始 apache 目錄/文件布局不同。 有關從 Apache 2.2 遷移到 2.4 的一般指南,請參閱此處升級到 2.4 此外,您可能還需要查看 debian 是否有一些有關更改的目錄/文件結構等的信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM