编写Nginx启停服务脚本
2024-10-19 06:41:32
在/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/
最新文章
- 浅谈requireJS
- windows环境下修改Mysql的root密码
- Qt create 配置git版本管理
- Android中分页滑动实现总结
- 借助mosquitto“实时”远程监控服务器数据库运行状态
- BZOJ3934 : [CQOI2015]标识设计
- JAVA 根据用户输入数据求某年到某年有多少天
- Some regret....
- 剑指Offer22 判断数组是否为某二叉搜索树的后序遍历
- Android应用开发基础篇(16)-----ScaleGestureDetector(缩放手势检测)
- sublime text 2安装及使用
- linux下crontab的使用实现
- [SF] Symfony 组件 BrowserKit 原理
- JAVA面试题集
- POST BOY : Restful API 调试工具
- ASP.NET Core Building chat room using WebSocket
- Python 练习:九九乘法表
- 记一次wepy里面的渲染问题(this.$apply()的使用)
- python2和python3网络访问包
- mysql优化——explain详解
热门文章
- [HTML5] Build Flexible HTML with HTMLTemplates using Slots and Web Components
- 批处理文件——多个QQ一键登录
- C# 5 in a Nutshell - Delegate
- unity3d格式的导出与加载
- 运行maven pom.xml文件后编译环境变为jdk1.5
- 《The Story of My Life》Introductiom - Historical and Literary Context - Education of the Deaf and Blind
- js实现页面元素随着内容的滚动而滚动
- 04-hibernate注解-一对一双向外键关联
- Android自己定义之流式布局
- js根据对象的某一属性进行排序