Nginx Resin安装中的相关技巧和操作流程

开发 前端
Nginx Resin在安装的过程中有不少的问题需要我们解决,下面就是在安装中的相关命令介绍以及一些技巧的介绍。希望大家有所收获。

我们在安装Nginx Resin的时候有不少的问题需要解决,相关的问题一直需要我们重视。其实很简单,只要是掌握好下面的相关命令你就能轻松的掌握Nginx Resin有关的技术应用。

  1. tar -xvf resin-3.1.9.tar.gz 

接着,将其移动到/usr/local/resin下面

  1. mv resin-3.1.9 /usr/local/resin 

接着进入Nginx Resin的目录,对其进行配置安装

  1. cd /usr/local/resin  
  2. ./configure  
  3. make   
  4. make install 

接着,我们需要将nginx配置为系统的服务

  1. vi /etc/rc.d/init.d/nginx 

在vi环境下,Nginx Resin有下以下内容:

程序代码

  1. #!/bin/bash  
  2. # nginx Startup script for the Nginx HTTP Server  
  3. # this script create it by gcec at 2009.10.22.  
  4. # it is v.0.0.1 version.  
  5. # if you find any errors on this scripts,please contact gcec cyz.  
  6. # and send mail to support at gcec dot cc.  
  7. # chkconfig: - 85 15  
  8. # description: Nginx is a high-performance web and proxy server.  
  9. # It has a lot of features, but it's not for everyone.  
  10. # processname: nginx  
  11. # pidfile: /var/run/nginx.pid  
  12. # config: /usr/local/nginx/conf/nginx.conf  
  13. nginxd=/usr/local/nginx/sbin/nginx  
  14. nginx_config=/usr/local/nginx/conf/nginx.conf  
  15. nginx_pid=/var/run/nginx.pid  
  16. RETVAL=0 
  17. prog="nginx" 
  18. # Source function library.  
  19. . /etc/rc.d/init.d/functions  
  20. # Source networking configuration.  
  21. . /etc/sysconfig/network  
  22. # Check that networking is up.  
  23. [ ${NETWORKING} = "no" ] && exit 0  
  24. [ -x $nginxd ] || exit 0  
  25. # Start nginx daemons functions.  
  26. start() {  
  27. if [ -e $nginx_pid ];then  
  28. echo "nginx already running...."  
  29. exit 1  
  30. fi  
  31. echo -n $"Starting $prog: "  
  32. daemon $nginxd -c ${nginx_config}  
  33. RETVAL=$?  
  34. echo  
  35. [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx  
  36. return $RETVAL  
  37. }  
  38. # Stop nginx daemons functions.  
  39. stop() {  
  40. echo -n $"Stopping $prog: "  
  41. killproc $nginxd  
  42. RETVAL=$?  
  43. echo  
  44. [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid  
  45. }  
  46. # reload nginx service functions.  
  47. reload() {  
  48. echo -n $"Reloading $prog: "  
  49. #kill -HUP `cat ${nginx_pid}`  
  50. killproc $nginxd -HUP  
  51. RETVAL=$?  
  52. echo  
  53. }  
  54. # See how we were called.  
  55. case "$1" in  
  56. start)  
  57. start  
  58. ;;  
  59. stop)  
  60. stop  
  61. ;;  
  62. reload)  
  63. reload  
  64. ;;  
  65. restart)  
  66. stop  
  67. start  
  68. ;;  
  69. status)  
  70. status $prog  
  71. RETVAL=$?  
  72. ;;  
  73. *)  
  74. echo $"Usage: $prog {start|stop|restart|reload|status|help}"  
  75. exit 1  
  76. esac  
  77. exit $RETVAL 

 

 

退出vi,接着,让Nginx Resin有可执行的权限

chmod +x nginx

再接着,将nginx加入到服务当中,chkconfig --add nginx。配置nginx的运行级别,让其可以在系统启动的时候跟着启动。chkconfig --level 35 nginx on

接着,我们可以通过以下命令来操作nginx
启动:service nginx start
关闭:service nginx stop
重起:service nginx restart

将Nginx Resin配置为系统服务:

进入$RESIN_HOME
进入contrib目录,将init.resin文件copy到/etc/rc.d/init.d/resin
cp init.resin /etc/rc.d/init.d/resin
给resin可执行的权限
chmod +x /etc/rc.d/init.d/resin
将resin加入到系统服务当中
chkconfig --add resin
将resin设置为自动启动
chkconfig --level 35 resin on
 

【编辑推荐】

  1. nginx配置文件实现AWStats静态页面
  2. nginx配置相关结构划分的技巧
  3. nginx参数站点配置上的问题解决方案
  4. nginx图片处理相关技巧介绍
  5. nginx反向代理的安装和测试的基本流程
责任编辑:张浩 来源: 博客园
相关推荐

2010-03-29 17:37:17

Nginx resin

2010-03-25 18:17:04

Nginx配置

2009-12-28 09:26:19

编译apache

2010-03-29 13:49:40

Nginx图片处理

2010-03-29 15:13:23

Nginx反向代理

2010-03-30 10:04:01

Nginx php

2010-01-04 14:49:30

Silverlight

2010-01-25 18:33:35

Android键盘操作

2009-12-10 17:27:39

PHP操作Cookie

2010-01-07 17:03:47

Linux操作系统

2010-01-28 14:12:20

Android Act

2010-01-06 17:02:28

.Net Framew

2010-05-04 16:20:11

resin负载均衡

2010-04-08 15:54:53

NTFS共享设置技巧

2009-12-28 14:04:44

ADO技术

2011-11-28 22:45:19

Nginxsession

2010-06-04 19:15:42

MySQL安装

2009-12-21 11:19:50

WCF配置文件

2010-01-28 16:55:26

Android对话框

2009-12-28 15:46:22

ADO.NET操作
点赞
收藏

51CTO技术栈公众号