在安裝nginx前,需先安裝了g++、gcc、openssl-devel、pcre-devel和zlib-devel軟體。
#yum -y install gcc gcc-c++ make autoconf automake libtool
#yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
檢查系統是否已安裝過nginx
#rpm -qa |grep nginx (find / -name nginx)
如有安裝,解除安裝
#yum remove nginx
2.安裝nginx
#cd /usr/local
# tar -zxvf nginx-1.7.12.tar.gz
#rm -rf nginx-1.7.12.tar.gz
#cd /usr/local/nginx-1.7.12
#./configure --prefix=/usr/local/nginx
#make && make install
3.設定開機啟動
新建自啟動指令碼
vi /etc/init.d/nginx
#!/bin/bash
##kconfig:345 85 15
#description:nginxisaworldwidewebserver.itisusedtoserve
# processname: nginx
nginx=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/nginx.pid
retval=0
prog="nginx"
# source function library.
. /etc/rc.d/init.d/functions
# source networking configuration.
. /etc/sysconfig/network
# check that networking is up.
[ $ = "no" ] && exit 0
[ -x $nginx ] || exit 0
# start nginx daemons functions.
start()
retval=$?
echo
[ $retval = 0 ] && touch /var/lock/subsys/nginx
return $retval
}# stop nginx daemons functions.
stop()
# reload nginx service functions.
reload() `
killproc $nginx -hup
retval=$?
echo
}# see how we were called.
case "$1" in
start)
start
;;stop)
stop
;;reload)
reload
;;restart)
stop
start
;;status)
status $prog
retval=$?
;;*)
echo $"usage: $prog "
exit 1
esac
exit $retval
#chmod +x /etc/init.d/nginx
新增為系統服務,開機自動啟動
#chkconfig --addnginx
#chkconfig nginx on
#service nginx start|restart|stop
CentOS 6 5 安裝配置
關於centos的安裝,網上有很多詳細的教程。其實重點就在於硬碟的分割槽和軟體的定製這兩塊。下面我在virtualbox虛擬機上安裝 centos 6.5 i386 minimal。1.在起始選單處選擇 install or upgrade an existing system 2.跳過 media...
CentOS6 5安裝配置Samba
本文的場景是虛擬機器執行centos6.5,本機是win7,現欲把centos上的乙個資料夾共享出來,win的機器可以讀寫。samba與window連線需要使用netbios協議,請確認你的win7系統已經安裝了netbios協議。組成samba執行的有兩個服務,乙個是smb,另乙個是nmb smb...
Centos6 5安裝配置keepalived
首先檢查安裝openssl devel yum install openssl devel 如果是離線,借鑑文章 configure prefix usr local keepalived with kernel dir usr src kernels 2.6.32 279.el6.x86 64 當...