Linux Nginx基本操作与配置

开发 前端
希望我的一点经验能给大家带来帮助,导致Linux Nginx出错的原因也许还有很多,不过在你遇到错误 时,可以先检查一下你程序中的字符串,暂时把他们置为,试试看。没准就是他引起的问题啊。

Linux Nginx是我们经常需要使用的命令环境。在这其中我们需要不断的学习,下面就是一些对Linux Nginx的详细介绍希望大家有所收获。激情体验,好事多磨你会找到他的乐趣。

  1. #!/bin/sh  
  2. # nginx - this script starts and stops the nginx daemin  
  3. # chkconfig: - 85 15   
  4. # description: Nginx is an HTTP(S) server, HTTP(S) reverse \  
  5. # proxy and IMAP/POP3 proxy server  
  6. # processname: nginx  
  7. # config: /etc/nginx/nginx.conf  
  8. # config: /etc/sysconfig/nginx  
  9. # pidfile: /var/run/nginx.pid  
  10. # Source function library.  
  11. . /etc/rc.d/init.d/functions  
  12. # Source networking configuration.  
  13. . /etc/sysconfig/network  
  14. # Check that networking is up.  
  15. [ "$NETWORKING" = "no" ] && exit 0  
  16. nginx="/usr/sbin/nginx" 
  17. prog=$(basename $nginx)  
  18. NGINX_CONF_FILE="/etc/nginx/nginx.conf" 
  19. [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx  
  20. lockfile=/var/lock/subsys/nginx  
  21. start() {  
  22. [ -x $nginx ] || exit 5  
  23. [ -f $NGINX_CONF_FILE ] || exit 6  
  24. echo -n $"Starting $prog: "  
  25. daemon $nginx -c $NGINX_CONF_FILE  
  26. retval=$?  
  27. echo  
  28. [ $retval -eq 0 ] && touch $lockfile  
  29. return $retval  
  30. }  
  31. stop() {  
  32. echo -n $"Stopping $prog: "  
  33. killproc $prog -QUIT  
  34. retval=$?  
  35. echo  
  36. [ $retval -eq 0 ] && rm -f $lockfile  
  37. return $retval  
  38. }  
  39. restart() {  
  40. configtest || return $?  
  41. stop  
  42. start  
  43. }  
  44. reload() {  
  45. configtest || return $?  
  46. echo -n $"Reloading $prog: "  
  47. killproc $nginx -HUP  
  48. RETVAL=$?  
  49. echo  
  50. }  
  51. force_reload() {  
  52. restart  
  53. }  
  54. configtest() {  
  55. $nginx -t -c $NGINX_CONF_FILE  
  56. }  
  57. rh_status() {  
  58. status $prog  
  59. }  
  60. rh_status_q() {  
  61. rh_status >/dev/null 2>&1  
  62. }  
  63. case "$1" in  
  64. start)  
  65. rh_status_q && exit 0  
  66. $1  
  67. ;;  
  68. stop)  
  69. rh_status_q || exit 0  
  70. $1  
  71. ;;  
  72. restart|configtest)  
  73. $1  
  74. ;;  
  75. reload)  
  76. rh_status_q || exit 7  
  77. $1  
  78. ;;  
  79. force-reload)  
  80. force_reload  
  81. ;;  
  82. status)  
  83. rh_status  
  84. ;;  
  85. condrestart|try-restart)  
  86. rh_status_q || exit 0  
  87. ;;  
  88. *)  
  89. echo $"Usage: $0 {start|stop|status|restart|condrestart|
    try-restart|reload|force-reload|configtest}"  
  90. exit 2  
  91. esac 

以上就是对Linux Nginx的详细介绍希望大家有所帮助。

【编辑推荐】

  1. nginx内核参数相关的优化设定
  2. Nginx Resin安装中的相关技巧和操作流程
  3. nginx resin相关程序的代码介绍
  4. Nginx反向代理支持的各种编程语言
  5. Nginx php安装过程中的技巧点评
责任编辑:张浩 来源: 互联网
相关推荐

2011-01-11 14:56:51

Linux基本操作

2010-03-29 10:12:04

Nginx优化设置

2009-06-12 15:13:12

Hibernate学习

2010-02-04 14:15:05

Linux Nginx

2010-02-03 15:19:28

Linux yum

2022-04-08 08:40:36

Nginx日志服务器

2015-07-23 11:36:28

GIT入门

2011-01-05 09:59:17

2009-12-22 14:43:38

Linux操作系统

2011-04-21 09:54:14

Linuxiptables

2010-03-29 10:26:06

Nginx配置文件

2024-01-24 13:40:45

2009-12-02 16:47:42

Linux操作系统

2016-12-29 12:42:45

Linux操作命令

2009-06-04 15:58:55

Struts原理基本配置

2010-03-30 14:22:01

Nginx静态文件

2010-08-06 15:44:11

Linux服务器

2023-05-11 08:59:43

Nginx配置服务器

2009-12-24 15:53:53

Linux配置wpa

2013-06-05 13:31:25

点赞
收藏

51CTO技术栈公众号