Centos7 设置自定义安装nginx的systemctl启动方式
一.systemctl方式启动设置过程
1.首先创建服务配置文件(名字和路径就是这个)
vim /usr/lib/systemd/system/nginx.service
2.添加配置内容
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target [Service]
Type=forking
ExecStart=/opt/nginx_116/sbin/nginx
ExecReload=/opt/nginx_116/sbin/nginx -s reload
ExecStop=/opt/nginx_116/sbin/nginx -s stop [Install]
WantedBy=multi-user.target
3.配置项解释
/opt/nginx_116/sbin/nginx 为本文安装nginx的文件路径,可见Centos7 安装编译nginx过程
[Unit]:服务的说明
Description:描述服务
After:描述服务类别
[Service]服务运行参数的设置
Type=forking是后台运行的形式
ExecStart为服务的具体运行命令
ExecReload为重启命令
ExecStop为停止命令
PrivateTmp=True表示给服务分配独立的临时空间
注意:启动、重启、停止命令全部要求使用绝对路径
[Install]服务安装的相关设置,可设置为多用户
4.使服务生效
systemctl daemon-reload
#以754的权限保存在目录:
/usr/lib/systemd/system
5.nginx服务的各种命令
#设置开机自启动
systemctl enable nginx.service
#启动nginx服务
systemctl start nginx.service
#停止开机自启动
systemctl disable nginx.service
#查看服务当前状态
systemctl status nginx.service
#重新启动服务
systemctl restart nginx.service
#查看所有已启动的服务
systemctl list-units --type=service
Centos7 设置自定义安装nginx的systemctl启动方式的更多相关文章
- centos7中设置nginx的systemctl启动方式
1.建立服务文件 (1)文件路径 vim /usr/lib/systemd/system/nginx.service (2)服务文件内容 [Unit] Description=nginx - high ...
- CentOS7.3编译安装Nginx设置开机启动
起因 最近想玩nginx了,本来用yum -y install nginx安装也启动好了,但是买了本<Nginx高性能Web服务器详解>,我咋能辜负我的书费呢?于是我就直接ps -ef | ...
- Linux centos7环境下安装Nginx
Linux centos7环境下安装Nginx的步骤详解 1. 首先到Nginx官网下载Nginx安装包 http://nginx.org/download/nginx-1.5.9.tar.gz ...
- centos7通过yum安装nginx
centos7通过yum安装nginx nginx不支持centos7通过yum直接安装~~~ 1.查看操作系统位数[root@-jenkins ~]# rpm -aq|grep centos-rel ...
- Windows 安装nginx并开机启动
Win安装nginx并 开机启动 下载nginx安装包 nginx-1.12.2.zip,解压到D盘. https://pan.baidu.com/s/1InQa527yq35Q68c73RBb-A# ...
- ubuntu 14.04 Clion2016.2 安装激活与安装后添加快捷启动方式
参考链接:http://www.cnblogs.com/conw/p/5938113.html 下载clion for linux : http://www.jetbrains.com/clion/d ...
- CentOS7.6编译安装nginx
配置阿里云yum源 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yu ...
- centos7最小版本安装nginx+tomcat+java+mysql运行环境
最近项目从windows搬到linux,由于项目组成员有限并且有其它紧急的任务需要处理,因而这个任务就落到我的头上了.下面记录下centos最小版本安装nginx+tomcat+mysql+java的 ...
- 【CNMP系列】CentOS7.0下安装Nginx服务
话步前言,CNMP之路,系统起步:http://www.cnblogs.com/riverdubu/p/6425028.html 这回我来讲解下CentOS7.0下如何安装和配置Nginx服务 Ngi ...
随机推荐
- eclipse 切换主题Theme
eclipse切换主题theme 1. 打开help -> eclipse marketplace,搜索theme 2. 点击右侧安装后一直继续,直到安装完成 3. 安装完成后会重启eclips ...
- thinkphp 连接webservice接口
嗯,我现在真的好像骂人啊,但是我又是个文明的人,所以我就写出来让自己冷静一下 ok,正事,thinkphp连别人写的webservice接口 刚开始他叫什么nc接口,就把我给骗了,这就是人家的名字,和 ...
- Robot Framework初级
一.robot framework环境搭建 二.robot 不同的测试库 三.创建项目 四.变量与常量 五.常用关键字介绍
- 通过POI实现上传EXCEL的批量读取数据写入数据库
最近公司新增功能要求导入excel,并读取其中数据批量写入数据库.于是就开始了这个事情,之前的文章,记录了上传文件,本篇记录如何通过POI读取excel数据并封装为对象上传. 上代码: 1.首先这是一 ...
- Python - 并发编程,多进程,多线程
传送门 https://blog.csdn.net/jackfrued/article/details/79717727 在此基础上实践和改编某些点 1. 并发编程 实现让程序同时执行多个任务也就是常 ...
- 中山纪中Day1--普及
早上一起,扑面是瓢泼的大雨.跨过千山万水,来到纪中门前,毅然以一种大无畏的英雄气概跨进了考场. 面对四道神题.然后,我成功过五关斩六将,A掉了2道题!!! 收获:优先队列(大.小根堆) T1:APPL ...
- Cosmetic Bottles - Cosmetic Packaging: What Are The Characteristics Of Trends?
There are certain differences in products, of which cosmetics are the most obvious. In addition to t ...
- opencv python:模糊操作
均值模糊 中值模糊 自定义模糊 模糊操作的基本原理 基于离散卷积 定义好每个卷积核 不同卷积核得到不同的卷积效果 模糊是卷积的一种表象 blur cv2.blur(image, (1, 3)) 第二个 ...
- Spring Boot 集成 Swagger2 教程
上篇讲过 Spring Boot RESTful api ,这篇简单介绍下 SwaggerUI 在 Spring Boot 中的应用. Swagger 是一个规范和完整的框架,用于生成.描述.调用和可 ...
- 一个支持国密SM2/SM3/SM4/SM9/ZUC/SSL的密码工具箱
转:https://blog.csdn.net/xuq09/article/details/91815366 The GmSSL Project网址:http://gmssl.org/docs/qui ...