nginx启动失败:Redirecting to /bin/systemctl start nginx.service Failed to start nginx.service: Unit not found.
解决方法:
是因为nginx没有有添加到系统服务,手动手动添加一个即可。
在 /etc/init.d/下创建名为nginx的启动脚本即可,内容如下:

#!/bin/bash
#
# chkconfig: - 85 15
# description: Nginx is a World Wide Web server.
# processname: nginx nginx=/usr/local/nginx/sbin/nginx
conf=/usr/local/nginx/conf/nginx.conf
case $1 in
start)
echo -n "Starting Nginx"
$nginx -c $conf
echo " done"
;;
stop)
echo -n "Stopping Nginx"
killall -9 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)
$0 stop
$0 start
;;
show)
ps -aux|grep nginx
;;
*)
echo -n "Usage: $0 {start|restart|reload|stop|test|show}"
;;
esac

保存。
注意,保存一定要保存成UNIX格式(notepad++:编辑--文档格式转换--转为UNIX格式),否则会如下报错的

设置执行权限:chmod +x /etc/init.d/nginx
注册成服务:chkconfig --add nginx
设置开机启动:chkconfig nginx on
之后,就可以使用以下命令了
service nginx start
service nginx stop
nginx启动失败:Redirecting to /bin/systemctl start nginx.service Failed to start nginx.service: Unit not found.的更多相关文章
- 安装和启动tftp-server服务器及可能出现Redirecting to /bin/systemctl restart xinetd.service问题的解决方式
安装和启动tftp-server服务器及可能出现Redirecting to /bin/systemctl restart xinetd.service问题的解决方式 1)首先,检查服务器已安装的tf ...
- 【Docker】Docker启动停止重启 Redirecting to /bin/systemctl start docker.service
[root@liuawen local]# docker -v Docker version 1.13.1, build cccb291/1.13.1 [root@liuawen local]# 启动 ...
- 重启ssh服务出现Redirecting to /bin/systemctl restart sshd.service
转自:https://blog.csdn.net/caijunfen/article/details/70599138 CentOs 重启ssh服务的命令如下: # service sshd rest ...
- Linux Redirecting to /bin/systemctl restart iptables.service
方案 一 1.昨天碰到一个错误,linux下输入命令:service iptables restart时,总会报下面一个提示很简单,这句话的意思就是让你重定向到systemctl然后再启用,白话就是说 ...
- Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied) nginx 启动失败
Starting nginx: nginx: [emerg] bind() to 0.0.0.0:8088 failed (13: Permission denied) nginx 启动失败 ...
- Win7 Nginx启动失败 cmd命令失败
Win7 Nginx启动失败 cmd命令失败 Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服 ...
- 解决Nginx启动失败
一.Nginx下载http://nginx.org/en/download.html 二.Nginx启动失败原因1.本人下载的是nginx-1.12.1(稳定版),下载完解压后,进入路径中,start ...
- 【linux】CentOS 6 使用cron定时任务,报错:Redirecting to /bin/systemctl restart crond.service
在centos7上,执行cron定时任务的相关命令,反馈如下: 定时任务执行,反馈是: Redirecting to /bin/systemctl restart crond.service 原因: ...
- 解决GitLab的Forbidden和Nginx启动失败
通过宝塔安装的GitLab突然出现Forbidden,原因居然是IP并发过大,IP被禁 解决方法: 登录服务器,编辑文件 /etc/gitlab/gitlab.rb ,将下面的截图内容放开注释(默认 ...
- nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket...permissions)
nginx启动失败 nginx启动失败(bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a ...
随机推荐
- Microsoft HoloLens 开发(1): 搭建 HoloLens 开发环境
1.硬件配置 64位 Windows 10 专业版, 企业版, or 教育版 (注: 家庭版不支持 Hyper-V 或者 HoloLens emulator) 64位 CPU 4核CPU (或者大于4 ...
- VMware_win10能ping通虚拟机ip,虚拟机ping不通win10ip的解决方法
一.虚拟机设置为桥接模式 二.修改虚拟机linux的ip 查看win10的ip和网关 使用ifconfig查看网卡名,并在 /etc/sysconfig/network-scripts/目录修改对应的 ...
- xml文件 加载properties文件的两种方法与注意事项
1.遇到的问题: 配置redisSpringContext.xml 时,遇到 properties加载失败,提示BeanDefinitionStoreException 和 java.lang. ...
- axios导出 excel
this.axios({ methods: 'get', url: url, responseType: 'blob' }).then(res => { const blob = new Blo ...
- css编写规则BEM
简单来说,格式如下: .block { /* styles */ } .block__element { /* styles */ } .block--modifier { /* styles */ ...
- testng 的常用注解
常用注解如下: @BeforeSuite: 此注解的方法会在当前测试集合中的任一测试用例前执行 @AfterSuite: 此注解的方法会在当前测试集合中的所有测试程序结束后执行 @BeforeTest ...
- Ubuntu 桌面版使用总结
最近拿出了大学时买的性(游)能(戏)本(机),其实从直观来看,硬件基础还是不错的,但是跑 WIN10, 清了各种广告,关了各种无效进城之后,用起来仍然还是很不爽.可能是已经用惯 mac 了吧,mac给 ...
- 使用.NET 6开发TodoList应用(31)——实现基于Github Actions和ACI的CI/CD
系列导航及源代码 使用.NET 6开发TodoList应用文章索引 需求和目标 在这个系列的最后一节中,我们将使用GitHub Actions将TodoList应用部署到Azure Container ...
- 《剑指offer》面试题64. 求1+2+…+n
问题描述 求 1+2+...+n ,要求不能使用乘除法.for.while.if.else.switch.case等关键字及条件判断语句(A?B:C). 示例 1: 输入: n = 3 输出: 6 示 ...
- 极客大挑战2019 http
极客大挑战 http referer 请求头 xff 1.查看源码,发现secret.php 2.提示要把来源改成Sycsecret.buuoj.cn,抓包,添加Referer Referer:htt ...
