Nginx Resin安裝中的相關(guān)技巧和操作流程
我們?cè)诎惭bNginx Resin的時(shí)候有不少的問題需要解決,相關(guān)的問題一直需要我們重視。其實(shí)很簡(jiǎn)單,只要是掌握好下面的相關(guān)命令你就能輕松的掌握Nginx Resin有關(guān)的技術(shù)應(yīng)用。
- tar -xvf resin-3.1.9.tar.gz
接著,將其移動(dòng)到/usr/local/resin下面
- mv resin-3.1.9 /usr/local/resin
接著進(jìn)入Nginx Resin的目錄,對(duì)其進(jìn)行配置安裝
- cd /usr/local/resin
- ./configure
- make
- make install
接著,我們需要將nginx配置為系統(tǒng)的服務(wù)
- vi /etc/rc.d/init.d/nginx
在vi環(huán)境下,Nginx Resin有下以下內(nèi)容:
程序代碼
- #!/bin/bash
- # nginx Startup script for the Nginx HTTP Server
- # this script create it by gcec at 2009.10.22.
- # it is v.0.0.1 version.
- # if you find any errors on this scripts,please contact gcec cyz.
- # and send mail to support at gcec dot cc.
- # chkconfig: - 85 15
- # description: Nginx is a high-performance web and proxy server.
- # It has a lot of features, but it's not for everyone.
- # processname: nginx
- # pidfile: /var/run/nginx.pid
- # config: /usr/local/nginx/conf/nginx.conf
- nginxd=/usr/local/nginx/sbin/nginx
- nginx_config=/usr/local/nginx/conf/nginx.conf
- nginx_pid=/var/run/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.
- [ ${NETWORKING} = "no" ] && exit 0
- [ -x $nginxd ] || exit 0
- # Start nginx daemons functions.
- start() {
- if [ -e $nginx_pid ];then
- echo "nginx already running...."
- exit 1
- fi
- echo -n $"Starting $prog: "
- daemon $nginxd -c ${nginx_config}
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
- return $RETVAL
- }
- # Stop nginx daemons functions.
- stop() {
- echo -n $"Stopping $prog: "
- killproc $nginxd
- RETVAL=$?
- echo
- [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid
- }
- # reload nginx service functions.
- reload() {
- echo -n $"Reloading $prog: "
- #kill -HUP `cat ${nginx_pid}`
- killproc $nginxd -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 {start|stop|restart|reload|status|help}"
- exit 1
- esac
- exit $RETVAL
退出vi,接著,讓Nginx Resin有可執(zhí)行的權(quán)限
chmod +x nginx
再接著,將nginx加入到服務(wù)當(dāng)中,chkconfig --add nginx。配置nginx的運(yùn)行級(jí)別,讓其可以在系統(tǒng)啟動(dòng)的時(shí)候跟著啟動(dòng)。chkconfig --level 35 nginx on
接著,我們可以通過以下命令來操作nginx
啟動(dòng):service nginx start
關(guān)閉:service nginx stop
重起:service nginx restart
將Nginx Resin配置為系統(tǒng)服務(wù):
進(jìn)入$RESIN_HOME
進(jìn)入contrib目錄,將init.resin文件copy到/etc/rc.d/init.d/resin
cp init.resin /etc/rc.d/init.d/resin
給resin可執(zhí)行的權(quán)限
chmod +x /etc/rc.d/init.d/resin
將resin加入到系統(tǒng)服務(wù)當(dāng)中
chkconfig --add resin
將resin設(shè)置為自動(dòng)啟動(dòng)
chkconfig --level 35 resin on
【編輯推薦】