Debian jessie 將 Apache 改成 2.4 的版本, 然後就全部爛掉了~ 設定檔需要做大幅度的修改, 做作筆記.
- apache2-mpm-event - transitional event MPM package for apache2
- apache2-mpm-itk - transitional itk MPM package for apache2
- apache2-mpm-prefork - transitional prefork MPM package for apache2
- apache2-mpm-worker - transitional worker MPM package for apache2
Apache 2.2 升級到 2.4 的 Conf 調整修復
參考網頁
- Upgrading to 2.4 from 2.2 - Apache HTTP Server
- Overview of new features in Apache HTTP Server 2.4 - Apache HTTP Server
- prefork - Apache HTTP Server
- worker - Apache HTTP Server
- event - Apache HTTP Server
- Authentication and Authorization - Apache HTTP Server
- Module Index - Apache HTTP Server
由 Debian wheezy => testing, 就會遇到 apache 2.2 升級到 2.4, 於是就出現下述錯誤訊息:
403 Forbidden
authz_core:error] [pid 6719] [client 122.96.59.104:57926] AH01630: client denied by server configuration
[Sun Nov 24 01:56:51.624289 2013] [authz_core:error] [pid 7250] [client 192.168.1.191:59434] AH01630: client denied by server configuration: /var/wwww/index.php
註: 第一次升級遇到問題要馬上先解決掉問題, 可以考慮先試試看此招, 之後再看下面的詳細研究:
- vim /etc/apache2/sites-enabled/0.conf # 內容如下
<Directory /var/>
Require all granted
</Directory> - /etc/init.d/apache2 reload
下述是 Apache 2.2 VS Apache 2.4 的設定檔有哪些變更差異
- Deny All
- 2.2 configuration:
- Order deny,allow
- Deny from all
- 2.4 configuration:
- Require all denied
- 2.2 configuration:
- Allow All
- 2.2 configuration:
- Order allow,deny
- Allow from all
- 2.4 configuration:
- Require all granted
- 2.2 configuration:
- Allow Host
- 2.2 configuration:
- Order Deny,Allow
- Deny from all
- Allow from example.org
- 2.4 configuration:
- Require host example.org
- 2.2 configuration:
- Directory 用 Require all granted
<Directory /var/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory> - FilesMatch 維持用 Order
<FilesMatch ".+\.phps$">
SetHandler application/x-httpd-php-source
Order Deny,Allow
Allow from all
</FilesMatch>
找出有哪些需要設定需要修改:
- cd /etc/apache2/sites-enabled/
- grep -i deny *
- grep -i "allow " *
- grep -i "allow " * | grep -v '#'
哪邊有放 www 的, 就會需要打開 directory
<Directory /home/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /var/> # 對整個開啟的話, 就跟 2.2 版一樣意思了.
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
另外, 目錄裡面沒有放 index.html 而出現的 403 錯誤, 如下:
[Sun Nov 24 02:18:51.160249 2013] [autoindex:error] [pid 10541] [client 192.168.1.191:59786] AH01276: Cannot serve directory /var/www/css/: No matching DirectoryIndex (index.html,index.php,slideshow.xul,index.xul) found, and server-generated directory index forbidden by Options directive, referer: http://example.com/
加上下述:
<Directory /var/www/>
Options FollowSymLinks Indexes
Require all granted
</Directory>
PHP 出現的 Warning
PHP Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the +date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone +identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/www/bin/a.php on line +11
上述設定 timezone 即可.
PHP 遇到另外的修改會有下述:
- apt-get install php5-json # json 需要另外安裝
- php5-curl 裡面的預設參數, 都要改2
- - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
- + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
在〈Apache 2.2 升級到 2.4 的 Conf 調整修復〉中有 4 則留言