/etc/init.d/下添加nginxd文件,内容如下:

#!/bin/bash
#
#chkconfig: -
#description: Nginx is a World Wide Web server.
#processname: nginx nginx=/usr/local/nginx/nginx
conf=/usr/local/nginx/nginx.conf case $ in
start)
echo -n "Starting Nginx"
$nginx -c $conf
echo " done"
;; stop)
echo -n "Stopping Nginx"
killall - nginx
echo " done"
;; test)
$nginx -t -c $conf
;; reload)
echo -n "Reloading Nginx"
ps auxww | grep nginx | grep master | awk '{print $2}' | xargs kill -HUP
echo " done"
;; restart)
$ stop
$ start
;; show)
ps -aux|grep nginx
;; *)
echo -n "Usage: $0 {start|restart|reload|stop|test|show}"
;; esac

添加执行权限

chmod +x /etc/init.d/nginxd

添加到服务

chkconfig --add nginxd

设置开机启动

chkconfig nginxd on

centos6.5 nginx开机启动的更多相关文章

  1. centos6.5 mysql开机启动

    可参考:centos6.5 nginx开机启动 /etc/init.d/下添加mysqld文件,内容如下: #!/bin/sh # Copyright Abandoned TCX DataKonsul ...

  2. centos6.5 tomcat开机启动

    可参考:centos6.5 nginx开机启动 /etc/init.d/下添加tomcatd文件,内容如下: #!/bin/sh # # chkconfig: - # # Licensed to th ...

  3. CentOS下nginx+php的配置及nginx开机启动配置

    关闭防火墙 (不然外链接是访问不了 apache) service iptables stop 关闭安全系统 SELinux( 不然报403 访问页面错误 ) 1.Nginx安装主要在于配置文件的修改 ...

  4. Centos7 Nginx开机启动

    1.简易安装nginx: ./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf ...

  5. nginx开机启动

    centos 7以上是用Systemd进行系统初始化的 Systemd服务文件以.service结尾,比如现在要建立nginx为开机启动,如果用yum install命令安装的,yum命令会自动创建n ...

  6. centos7.2 下 nginx 开机启动

    1.在系统服务目录里创建nginx.service文件 1 vi /lib/systemd/system/nginx.service 内容如下 1 2 3 4 5 6 7 8 9 10 11 12 1 ...

  7. Centos7 Nginx 开机启动

    Centos 系统服务脚本目录: 用户(user) 用户登录后才能运行的程序,存在用户(user) /usr/lib/systemd/ 系统(system) 如需要开机没有登陆情况下就能运行的程序,存 ...

  8. [转]centos7.2 下 nginx 开机启动

    1.在系统服务目录里创建nginx.service文件 vi /lib/systemd/system/nginx.service 内容如下 [Unit] Description=nginx After ...

  9. Linux上如何设置nginx开机启动

    连接上linux后输入以下命令--vim /etc/init.d/nginx 然后在这个空文件写入下面内容: 保存好后,修改下该文件权限--chmod 777 /etc/init.d/nginx 然后 ...

随机推荐

  1. html5入门

    1.canvas标签 <canvas id="myCanvas"></canvas><!--canvas标签定义图形,比如图标和其他图像--> ...

  2. oracle 中的trunc()函数及加一个月,一天,一小时,一分钟,一秒钟方法

    返回处理后的数据,不同于round()(对数值进行四舍五入处理),该函数不对指定小数前或后的数值部分进行舍入处理. 语法:trunc(number[,decimals]) 其中,number为待做处理 ...

  3. JS keycode 事件响应

    <script language="javascript"> function keyevent(){ if(event.keyCode==13) alert(&quo ...

  4. IIS 您要访问的网页有问题,无法显示!

    提示:您要访问的网页有问题,无法显示.HTTP 500 – 内部服务器错误.”的问题解决方案! IIS服务器出现错误的原因很多,请尝试以下操作:1.查看网站属性——文档看看启用默认文档中是否存在:in ...

  5. ASP数据库操作方法

    首先,必须要使用打开数据库方法: <% dim objconn,objconnstr set objconn=server.createobject("adodb.connection ...

  6. ios修改textField的placeholder的字体颜色和大小

    textField.placeholder = @"username is in here!"; [textField setValue:[UIColor redColor] fo ...

  7. QT中Sqlite的使用

    环境: 静态编译过sqlite 步骤: 1.C++链接器中加入Sqlite.lib,然后在测试一下是否能正常加载Sqlite驱动 #include<QtPlugin> Q_IMPORT_P ...

  8. 2014牡丹江D Domination

    Domination Time Limit: 8 Seconds      Memory Limit: 131072 KB      Special Judge Edward is the headm ...

  9. sql批量更换dedecms文章来源和作者

    前面写了一篇修改dedecms默认文章来源 "未知"改为关键词,那个是修改以后发布的文章“来源”才会变成自己设定的关键词,如果修改之前已经有很多文章了,那些文章“来源”还是显示“未 ...

  10. 素数的线性筛 && 欧拉函数

    O(n) 筛选素数 #include<bits/stdc++.h> using namespace std; const int M = 1e6 + 10 ; int mindiv[M] ...