[ISSUE] [Centos] Centos Start Nginx Show: Failed to start nginx.service:unit not found
CMD Line:systemctl start nginx.service
Failed to start nginx.service: Unit not found.
Solution:
1.vim /etc/init.d/nginx
#!/bin/sh
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - # description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server # processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit nginx="/usr/local/nginx/sbin/nginx" prog=$(basename $nginx) NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" lockfile=/var/lock/subsys/nginx start() { [ -x $nginx ] || exit [ -f $NGINX_CONF_FILE ] || exit echo -n $"Starting $prog: " daemon $nginx -c $NGINX_CONF_FILE retval=$? echo [ $retval -eq ] && touch $lockfile return $retval } stop() { echo -n $"Stopping $prog: " killproc $prog -QUIT retval=$? echo [ $retval -eq ] && rm -f $lockfile return $retval } restart() { configtest || return $? stop start } reload() { configtest || return $? echo -n $"Reloading $prog: " killproc $nginx -HUP RETVAL=$? echo } force_reload() { restart } configtest() { $nginx -t -c $NGINX_CONF_FILE } rh_status() { status $prog } rh_status_q() { rh_status >/dev/null >& } case "$1" in start) rh_status_q && exit
$
;; stop) rh_status_q || exit
$
;; restart|configtest)
$
;; reload)
rh_status_q || exit
$
;; force-reload)
force_reload
;;
status)
rh_status
;; condrestart|try-restart) rh_status_q || exit
;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit esac
3. cd /etc/init.d
4
# chmod 755 /etc/init.d/nginx
# chkconfig --add nginx
5. service nginx start
[ISSUE] [Centos] Centos Start Nginx Show: Failed to start nginx.service:unit not found的更多相关文章
- CentOS 7 防火墙 出现Failed to start iptables.service: Unit iptables.service failed to load
错误信息如下: [root]# service iptables start Redirecting to /bin/systemctl start iptables.service Failed t ...
- CentOS 7出现Failed to start firewalld.service: Unit is masked的解决办法和firewalld 防火墙开关
说明:刚刚使用systemctl start firewalld命令开启防火墙的时候,却开不成功,出现Failed to start firewalld.service: Unit is masked ...
- Failed to stop iptables.service: Unit iptables.service not loaded.解决方法
CentOS7中执行 service iptables start/stop 会报错Failed to start iptables.service: Unit iptables.service fa ...
- centOS7中启动MySQL数据库提示: Failed to start mysqld.service: Unit not foundc
现象: 在centOS7中启动MySQL数据库提示: Failed to start mysqld.service: Unit not found [明明已经安装了,为什么提示不存在呢?] 原因: 在 ...
- centos7安装MariaDB以及Failed to start mariadb.service: Unit not found的错误解决
centos7下yum安装MariaDB CentOS 7下mysql下替换成MariaDB了.MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权 许可 Mari ...
- Failed to start mongod.service: Unit not found
其实自己用惯的是MYSQL,然后项目最后一步完善数据读写的部分,本来打算用mysql的,然而在centOS系统上发现安装总是出问题,后来查找一下资料,发现centOS系统上一般用的是Mariadb,这 ...
- Failed to start ssh.service: Unit not found.
Failed to start ssh.service: Unit not found. 报错内容: [Centos7@localhost ~]$ service ssh start Redirect ...
- Failed to restart ssh.service: Unit not found.
环境 操作系统:CentOS 7 问题 重启ssh服务,启动报错:Failed to restart ssh.service: Unit not found. 操作步骤 1. 编辑sshd_confi ...
- Failed to stop iptables.service: Unit iptables.service not loaded.
redhat 7 [root@lk0 ~]# service iptables stop Redirecting to /bin/systemctl stop iptables.service Fai ...
- centos7 Failed to start firewalld.service: Unit is masked.
centos7 启动防火墙失败:Failed to start firewalld.service: Unit is masked. ---- 刚yum安装了iptables 解决: 执行”sys ...
随机推荐
- php替换字符串函数strtr()和str_repalce()区别
php中替换函数主要有strtr(),str_repalce()这两个函数,但你们都知道他们这两个函数的区别和用法吗? 先来看看这个php字符串替换函数 strtr()的两种用法: strtr(str ...
- goroutine 和线程的区别
好久没写点儿啥了,强行更新一下. 1,从使用上讲 1,goroutine 比线程更轻量级,可以创建十万.百万不用担心资源问题. 2,goroutine 和 chan 搭配使用,实现多线程.高并发 实现 ...
- oracle的用户管理
创建用户 在Oracle中创建用户需要用到dba,普通用户无法创建 > create user 用户名 identified by 密码; * 密码必须以英文开头,不然是创建不起来的! * 如果 ...
- Exception in thread "main" java.lang.IllegalStateException: Failed to read Class-Path attribute from manifest of jar file:
表示jar所在位置文件夾中沒有下載好,將目標目錄刪除,重新maven下就好了
- Axure软件界面及元件
Axure 软件的需求史 功能:用来制作快速原型的软件.也可以绘制中保真原型草图. (适用人群:产品经理,交互设计师,UI设计师,网页设计师, 想要自己提升的人[重]) 原型分类: 低保真原型(草图) ...
- Java中的常用集合类型总结
1.可重复列表(List) LinkedList和ArrayList的区别:http://www.importnew.com/6629.html ArrayList vs. LinkedList vs ...
- PHP 多个构造函数
class A { function __construct() { $a = func_get_args(); $i = func_num_args(); if (method_exists($th ...
- robotframework RF使用中需要安装的工具和库
确保 Python 3.6.2 安装成功 安装 如下 RF使用中需要的工具和库 1. RF 在两个Python中安装 robotframework执行命令 pip install robotframe ...
- js点击复制剪贴板
代码用原生写的.工作中用的angular,所以如果有用angular的话,请把js代码copyToClipboard函数中的document.getElementById(elementId).inn ...
- /etc/inittab文件详解
/etc/inittab由/sbin/init程序解析调用,用于系统初始化,/sbin/init可参考源码busybox中init.c的实现方式. 原址如下: http://leejia.blog.5 ...