在/etc/init.d/目录下创建脚本

vim  /etc/init.d/nginx 

编写脚本内容:(其中下面2行需要根据情况自行修改)

nginxd=/opt/nginx/sbin/nginx
nginx_config=/opt/nginx/conf/nginx.conf

脚本下载链接:http://pan.baidu.com/s/1jGrK0Vs 密码:cxjb

更改脚本权限

chmod 777 /etc/init.d/nginx 

测试

service nginx start 或/etc/init.d/nginx start 

开机启动

chkconfig --list|grep nginx chkconfig --add nginx 
chkconfig --list|grep nginx nginx           0:关闭    1:关闭    2:关闭    3:关闭    4:关闭    5:关闭    6:关闭 # chkconfig --level 2345 nginx on # chkconfig --list|grep nginx nginx           0:关闭    1:关闭    2:启用    3:启用    4:启用    5:启用    6:关闭 

或将此命令加入到rc.local文件中,这样开机的时候nginx就默认启动了

vi /etc/rc.local 

加入一行 /etc/init.d/nginx start 保存并退出,下次重启会生效。

艺搜参考

http://www.imhdr.com/nginx/linux-centos-to-configure-nginx-mysql-php-fpm-redis-boot/

最新文章

  1. 浅谈requireJS
  2. windows环境下修改Mysql的root密码
  3. Qt create 配置git版本管理
  4. Android中分页滑动实现总结
  5. 借助mosquitto“实时”远程监控服务器数据库运行状态
  6. BZOJ3934 : [CQOI2015]标识设计
  7. JAVA 根据用户输入数据求某年到某年有多少天
  8. Some regret....
  9. 剑指Offer22 判断数组是否为某二叉搜索树的后序遍历
  10. Android应用开发基础篇(16)-----ScaleGestureDetector(缩放手势检测)
  11. sublime text 2安装及使用
  12. linux下crontab的使用实现
  13. [SF] Symfony 组件 BrowserKit 原理
  14. JAVA面试题集
  15. POST BOY : Restful API 调试工具
  16. ASP.NET Core Building chat room using WebSocket
  17. Python 练习:九九乘法表
  18. 记一次wepy里面的渲染问题(this.$apply()的使用)
  19. python2和python3网络访问包
  20. mysql优化——explain详解

热门文章

  1. [HTML5] Build Flexible HTML with HTMLTemplates using Slots and Web Components
  2. 批处理文件——多个QQ一键登录
  3. C# 5 in a Nutshell - Delegate
  4. unity3d格式的导出与加载
  5. 运行maven pom.xml文件后编译环境变为jdk1.5
  6. 《The Story of My Life》Introductiom - Historical and Literary Context - Education of the Deaf and Blind
  7. js实现页面元素随着内容的滚动而滚动
  8. 04-hibernate注解-一对一双向外键关联
  9. Android自己定义之流式布局
  10. js根据对象的某一属性进行排序