Centos安裝
Apache 2.4.10步驟 For CentOS 6.X (32bits)
.1 安裝
apache 前準備
1-1.安裝 gcc compiler and library
yum install gc*
1-2.下載 Apache
http://httpd.apache.org/download.cgi#apache24
(httpd-2.4.10.tar.gz )
1-3.下載 apr library
https://apr.apache.org/download.cgi (apr-1.5.1.tar.gz)
1-4. 下載 apr-util library
https://apr.apache.org/download.cgi (apr-util-1.5.4.tar.gz)
1-5. 下載 PCRE
http://sourceforge.net/projects/pcre/files/pcre/ (pcre-8.36.tar.gz)
1-6. 解開各 apr gz檔
#
cd /home/temp
#
tar zxvf apr-1.5.1.tar.gz
# tar zxvf apr-util-1.5.4.tar.gz
1-7.安裝 pcre
#
cd /home/temp
# tar
zxvf pcre-8.36.tar.gz
#
cd pcre-8.36/
#
./configure --prefix=/usr/local/pcre
#
make
#
make install
2.安裝 apache
# cd /home/temp
# tar zxvf httpd-2.4.10.tar.gz
# cd httpd-2.4.10/
# mv /home/temp/apr-1.4.6 httpd-2.4.10/srclib/apr
# mv /home/temp/apr-util-1.4.1 httpd-2.4.10/srclib/apr-util
# ./configure --prefix=/usr/local/apache --enable-so --with-included-apr
-with-pcre=/usr/local/pcre
# make
# make install
3. 安裝完畢後,為 apache
建立開機自動啟動的 script
#cp build/rpm/httpd.init /etc/init.d/httpd
#cp build/rpm/httpd.init /etc/init.d/httpd
接著進行修改 /etc/init.d/httpd
> vim /etc/init.d/httpd 修改下列2處 第60行:httpd=${HTTPD-/usr/sbin/httpd} ->
改為 -> httpd=${HTTPD-/usr/local/apache/bin/httpd} 第61行:pidfile=${PIDFILE-/var/run/${prog}.pid} ->
改為 -> pidfile=${PIDFILE-/usr/loacal/apache/logs/${prog}.pid}
在 /usr/sbin 下建立與 /usr/local/apache/bin/ 的連結 > ln -s /usr/local/apache/bin/* /usr/sbin/ 再來建立 log 紀錄檔的連結 > ln -s /usr/local/apache/logs /var/log/httpd 接下來就可以嘗試啟動 apache 了 > /usr/local/apache/bin/httpd -k start 或 service httpd start 若啟動時出現這個錯誤訊息 Starting httpd: AH00558: httpd: Could not reliably determine
the server's fully qualified domain name, using localhost.localdomain.
Set the 'ServerName' directive globally to suppress this message 請修改 /usr/local/apache/conf/httpd.conf 第 192 行,
將 ServerName localhost 的註解拿掉就行了
接著請打開您的瀏覽器,在網址列輸入您的機器 IP (http://{機器ip}/),若頁面出現 It works! 的大字樣就代表安裝成功~~
若發現回應很久之後出現無法連上的狀況,請確定是否你的機器的防火牆是開啟的狀態,輸入以下指令關閉防火牆
讓Apache 可以執行 cgi-bin,修改 httpd.conf 將下列之前#符號去除,restart Apache
LoadModule cgi_module
modules/mod_cgi.so
資料庫的設定 (Apache 2.4.10 )
### ctime
###
ScriptAlias /ctnewsc/ /HOME/ctnews/
Alias /ctnewsh/ /HOME/ctnews/
<DIrectory
/HOME/ctnews/>
Options +ExecCGI
-MultiViews
AllowOverride None
Require all granted
</Directory>
沒有留言:
張貼留言