菜鳥學Linux第058篇筆記httpd編譯安裝
菜鳥學Linux 第058篇筆記 httpd編譯安裝
PHP: 指令碼程式語言,php直譯器
WebApp: 物件導向的特性
Zend引擎:
第一段: 語法分析、語法分析、編譯為Opcode;
opcode旋轉於記憶體中
第二段: 執行Opcode;
PHP 快取器
APC
eAccelerator
XCache
PHP直譯器–>MySQL, 如何互動?
bash: a.sh
PHP程式 : b.php
php53-mysql 驅動
httpd+php:
CGI
module
FastCGI/fpm port: 9000
web效能優化(動態內容靜態化)
httpd
快取:可以把動態指令碼執行後所返回的內容儲存在httpd的快取裡,
第二次有使用者再請求時,則可快速響應
應用程式伺服器
快取:可以把使用者所請求的動態程式碼,編譯成二進位制可執行的格式
並放入快取中,第二次有其它使用者請求時,則可直接執行,而不
再進行編譯的過程
編譯配置LAMP:
Linux, Apache, MySQL, PHP(Python, Perl)
編譯安裝順序
httpd –> MySQL –> php –> XCache
Apache: ASF(apache軟體基金會), httpd, tomcat, cloudware
httpd 2.4.4
php 5.4.13
MySQL 5.5 (rpm,通用二進位制,原始碼)
rpm包
/bin, /sbin, /usr/bin, /usr/sbin
/lib, /usr/lib
/etc
/usr/share/{doc,man}
編譯安裝
/usr/local/
bin, sbin
lib
etc
share/{doc,man}
/usr/local/apr/
bin, sbin, lib, includes, etc, share/man
(注意需要新增環境變數,庫連線,man文件)
httpd編譯安裝
apr: Apache Portable Runtime
apr apr-util apr-iconv
安裝順序: apr –> apr-util –> httpd
下載apr apr-util httpd www.apache.org
安裝apr
# tar -xf apr-1.5.2.tar.gz
# cd apr-1.5.2
# ./configure –prefix=/usr/local/apr
# make
# make install
安裝apr-util
# tar -xf apr-util-1.5.4.tar.gz
# cd apr-util-1.5.4
# ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
# make
# make install
安裝httpd
# tar -xf httpd-2.4.25.tar.bz2
# cd httpd-2.4.25.tar.bz2
./configure –prefix=PATH –sysconfdir=PATH
–enable-so –enable-ssl –enable-deflate –enable-proxy-fcgi
–enable-cgi –enable-cgid –enable-modules=most –enable-mods-shared=most
–enable-mpms-shared={prefork|worker|event|all 可多選} –with-mpm=event
–enable-rewrite
–with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util (注意這些是一行內容)
# make
# make install
/etc/httpd/httpd.conf
Pidfile “/var/run/httpd.pid”
vim /etc/rc.d/init/httpd
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: – 85 15
# description: Apache is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi
# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-“C”}
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=””
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based “worker” MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache/bin/apachectl
httpd=${HTTPD-/usr/local/apache/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0
start() {
echo -n $”Starting $prog: “
LANG=$HTTPD_LANG daemon –pidfile=${pidfile} $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $”Stopping $prog: “
killproc -p ${pidfile} -d 10 $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $”Reloading $prog: “
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $”not reloading due to configuration syntax error”
failure $”not reloading $httpd due to configuration syntax error”
else
killproc -p ${pidfile} $httpd -HUP
RETVAL=$?
fi
echo
}
# See how we were called.
case “$1” in
start)
start
;;
stop)
stop
;;
status)
status -p ${pidfile} $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $”Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}”
exit 1
esac
exit $RETVAL
chmod +x /etc/init.d/httpd
chkconfig -add httpd
chkconfig –level 35 httpd on
新增環境變數 /etc/profile.d/
vim httpd.sh
export PATH=$PATH:/usr/local/apache/bin
(不會立即生效,需要重新開啟shell)
變更模組 /etc/httpd/httpd.conf
#LoadModule env_module modules/mod_env.so
LoadModule prefork_module modules/mod_prefork.so
(到此編譯安裝httpd結束)
httpd 2.4新特性
1、MPM可於執行時裝載
2、Event MPM 可正式使用
3、非同步讀寫
5、每請求配置:<If>, <ElseIf>, <Else>;
6、增強的表示式分析器;
7、毫秒組的KeepAlive Timeout;
8、基於域名的虛擬主機不再需要NameVirtualHost指令
9、降低了記憶體佔用
10、支援在配置檔案中使用自定義變數;
新增加的模組
mod_proxy_fcgi
mod_proxy_scgi
等等
對於基於IP的訪問控制
廢除
Order allow,deny
allow from all
2.4使用Require user
Require (not) ip IPADDR
IP
NETWORK/MASK
NETWORK/LENGTH
NET
172.16.0.0/255.255.0.0 = 172.16.0.0/16 = 172.16
Requre host HOSTNAME
HOSTNAME
DOMAIN
www.mysky.com
mysky.com
所有主機
Require all granted
Require all deny
相關文章
- 菜鳥學Linux第059篇筆記編譯安裝MySQL,PHP壓力測試Linux筆記編譯MySqlPHP
- 菜鳥學Linux 第111篇筆記 MemoryLinux筆記
- 菜鳥學Linux第055篇筆記php基礎Linux筆記PHP
- httpd編譯安裝phphttpd編譯PHP
- 鳥哥私房菜學習筆記(第零章)筆記
- linux-鳥哥私房菜學習筆記Linux筆記
- httpd-2.4 編譯安裝(centos6)httpd編譯CentOS
- Android菜鳥學習js筆記一AndroidJS筆記
- httpd 一鍵編譯安裝指令碼(centos6&7_httpd2.2&2.4)httpd編譯指令碼CentOS
- Linux C++ 自學筆記之二<菜鳥初學系列> (轉)LinuxC++筆記
- 菜鳥的讀書筆記筆記
- 菜鳥也玩mysql之學習筆記篇MySql筆記
- 菜鳥也裝Linux(轉)Linux
- 【菜鳥教程筆記】Python字串筆記Python字串
- MFC入門——菜鳥級筆記筆記
- 【菜鳥筆記|機器學習】神經網路筆記機器學習神經網路
- Linux yum安裝httpd報錯 No package httpd available ?LinuxhttpdPackageAI
- 鳥哥的Linux私房菜筆記第六章Linux筆記
- 「Linux」鳥叔私房菜第五章讀書筆記Linux筆記
- 菜鳥!安裝lumaqq的問題!!(轉)
- ffmpeg安裝之linux編譯安裝Linux編譯
- Linux編譯安裝NginxLinux編譯Nginx
- 原始碼編譯安裝 httpd2.4+MariaDB5.5+php5.4(LAMP)原始碼編譯httpdPHPLAMP
- Linux上編譯安裝Apache出現httpd: Could not reliably determine the server's fully qualified domain nameLinux編譯ApachehttpdServerAI
- 【編譯openjdk學習筆記】編譯JDK筆記
- 菜鳥筆記之資料結構(24)筆記資料結構
- 鳥哥私房菜-基礎篇小筆記筆記
- 菜鳥筆記之PWN入門(1.0.0)前言筆記
- LAMP全功能編譯安裝forCentOS6.3筆記(更新)LAMP編譯CentOS筆記
- Linux 學習筆記 - 軟體安裝Linux筆記
- Linux 編譯 安裝 PHP 7.3.1Linux編譯PHP
- Linux gcc編譯器安裝LinuxGC編譯
- Linux下編譯安裝BOOSTLinux編譯
- Linux 編譯安裝 PythonLinux編譯Python
- Kaldi學習手記(一):Kaldi的編譯安裝編譯
- Linux“菜鳥”到“菜鳥的一些建議Linux
- 【MySQL安裝】Linux下安裝MySQL(預編譯)MySqlLinux編譯
- PHP Linux安裝擴充套件(編譯安裝)PHPLinux套件編譯