前提

apache 2.4.x 版本也出了一段時間了 ( Apache推出2.4版本,有什麼功能)

就算知道它有什麼功能了,但還是很模糊

先來安裝看看吧 (我用編譯的,先不破壞原本rpm安裝起來的環境)

環境
  • CentOS 5.x
  • httpd 2.2.22
  • php 5.1.6
工具
  • httpd-2.4.2.tar.gz
  • apr-1.4.6.tar.gz
  • apr-util-1.4.1.tar.gz
  • php-5.3.14.tar.gz (一定要 PHP 5.3 以上,不然就算編譯成功也無法使用)
安裝

apr

./configure  --prefix=/usr/local/apr

apr-util

./configure  --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/

httpd

./configure --prefix=/usr/local/apache --enable-module=all --enable-rewrite --enable-suexec --enable-shared=max  --enable-ssl --enable-so  --with-mpm=prefork --enable-mime-magic --enable-suexec --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-socache-shmcb
編譯完後

我把 /etc/httpd/conf/httpd.conf 及 /etc/httpd/conf.d/ 檔案複製到 /usr/local/apache,完全用 RPM 的 conf 來作測試

一開始會碰到模組找不到,所以要把 LoadModule XXX modules/mod_XXX.so 換成 LoadModule XXX /usr/local/apache/modules/mod_XXX.so

%s/ modules\// \/usr\/local\/apache\/modules\//g

再來其實有很多問題產生

有不支援的參數語法、有不認識的(因為沒有載入正確的模組) 等等

Q&A

Q: Invalid command ‘Order’, perhaps misspelled or defined by a module not included in the server configuration

A: http://httpd.apache.org/docs/2.4/upgrading.html
加入這個模組

LoadModule access_compat_module /usr/local/apache/modules/mod_access_compat.so

Q: SSLSessionCache: ‘shmcb’ session cache not supported (known names: ). Maybe you need to load the appropriate socache module (mod_socache_shmcb?).

A: LoadModule socache_shmcb_module /usr/local/apache/modules/mod_socache_shmcb.so

Q: Invalid command ‘SSLMutex’, perhaps misspelled or defined by a module not included in the server configuration

A: Directives AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex, and WatchdogMutexPath have been replaced with a single Mutex directive. You will need to evaluate any use of these removed directives in your 2.2 configuration to determine if they can just be deleted or will need to be replaced using Mutex.

意思是不支援SSLMutex 這個了,不過可以用 ↓

Mutex default ssl-cache

Q: [Wed Jun 20 23:24:01.544007 2012] [proxy_balancer:emerg] [pid 19809] AH01177: Failed to lookup provider ‘shm’ for ‘slotmem’: is mod_slotmem_shm loaded??

A: LoadModule slotmem_shm_module /usr/local/apache/modules/mod_slotmem_shm.so

Q: AH02155: getpwuid: couldn’t determine user name from uid -1, you probably need to modify the User directive

A: debug 過程中曾有把這兩行註解,所以產生以上錯誤,再把它解開即可,不過我也忘記為何要註解這兩行了

User apache
Group apache

 

Q: AH00027: Buggy authn provider failed to set user for

A: LoadModule authz_core_module /usr/local/apache/modules/mod_authz_core.so

最後編譯 PHP 5.3

./configure '--prefix=/usr/local/php' '--with-bz2' '--with-curl' '--with-gettext' '--with-gmp' '--with-iconv' '--with-openssl' '--with-png' '--with-pspell' '--with-zlib' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic' '--with-xml' '--with-system-tzdata' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-mysql' '--with-gd' --enable-mbstring --with-mysqli

完工…

Related posts 相關文章
apache httpd 2.4.58 有些安全性更新
More...
Apache 有 path traversal 目錄遍歷的漏洞
More...
CentOS7 透過 systemd 自動讓服務 restart 重啟
More...
用 GoAccess 即時分析 IIS Access Log
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。