首页 > 系统相关 >配置nginx开机启动

配置nginx开机启动

时间:2023-10-13 23:05:05浏览次数:32  
标签:sbin service 启动 nginx systemctl usr 开机 local

切换到/lib/systemd/system/目录,创建nginx.service文件

vim nginx.service

[unit]
description=nginx 
after=network.target 
 
[service] 
type=forking 
execstart=/usr/local/nginx/sbin/nginx
execreload=/usr/local/nginx/sbin/nginx reload
execstop=/usr/local/nginx/sbin/nginx quit
privatetmp=true 
 
[install] 
wantedby=multi-user.target

退出并保存文件,执行systemctl enable nginx.service使nginx开机启动

systemctl start nginx.service    启动nginx
systemctl stop nginx.service    结束nginx
systemctl restart nginx.service    重启nginx


标签:sbin,service,启动,nginx,systemctl,usr,开机,local
From: https://blog.51cto.com/kele/7852318

相关文章

  • 下载的PC游戏启动后报错:无法加载 DLL“steam_api64”: 动态链接库(DLL)初始化例程失败
    无法加载DLL“steam_api64”:动态链接库(DLL)初始化例程失败。(异常来自HRESU解决方式:将文件夹拷贝到Steam-->steamapps文件夹下面还好是忍者神龟抛了个异常,才找到了问题所在,论抛异常的重要性!!!忍者神龟如龙......
  • 将java程序,安装为windows服务,开机自启动
    借助WindowsServiceWrapper小工具,将java程序转换为Windows服务,在服务中心配置自启动,从而在开机时windows自行启动服务。WindowsServiceWrapper下载URL:https://github.com/winsw/winsw/releases如下图,为windows32位和64位的工具文件 32位:链接: https://pan.baidu.co......
  • 编译安装CENTOS7.6+NGINX1.8+MYSQL5.7+PHP7.9+ZABBIX5.0
    LNMP系统安装环境准备:系统版本:CentOSLinuxrelease7.6.1810(Core)PHP版本:php-7.4.9NGINX版本:nginx-1.19.2MYSQL版本:MySQL5.7.43zabbix版本:zabbix-5.0.3以下为下载地址PHPNginxMYSQLzabbixPHP依赖包 把下载的源码包都上传到服务器上,并解压[root@zabbixserver......
  • lower_case_table_names=1 mysql启动失败问题
    1先停掉mysql数据库2删除mysql数据,在初始话时,数据所在的位置3修改/etc/my.cnf配置,添加lower_case_table_names=14重新初始化./mysqld--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data--initialize-insecure--lower-case-table-names=1;注意初始化......
  • Hive-服务启动和停止命令
    1、启动命令#!/bin/bashnohuphive--servicemetastore>>$HIVE_HOME/logs/metasotre.log2>&1&nohuphive--servicehiveserver2>>$HIVE_HOME/logs/hiveserver.log2>&1&2、停止命令#!/bin/bashprocess="hive"PID=$(p......
  • Linux系统下配置Nginx使部分URL使用多套自定义的PHP-FPM配置
    Nginx修改演示:vim/usr/local/nginx/conf/vhost/example.comserver{ listen80; server_name192.168.1.180; location/{ root/Code/project/public; indexindex.phpindex.html; include/usr/local/nginx/conf/rewrite/laravel.conf;location~\.......
  • Tomcat启动出现乱码解决方案
    解决方案就是把所有相关的地方编码方式都设为utf-8Windows命令行参考我这篇博文链接Tomcat日志配置在tomcat主目录下找到/conf/logging.properties这个文件,用文本编辑器打开,其中有一行java.util.logging.ConsoleHandler.encoding=UTF-8,这项新版本Tomcat一般已经设置为了ut......
  • Linux系统中tomcat设置开机自启动
    1.添加tomcat服务文件cd/etc/init.d vimtomcat在tomcat中添加如下配置#!/bin/bash#chkconfig:23451090#description:StartsandStopstheTomcatdaemon.#/etc/init.d/tomcatd#Tomcatauto-start#Sourcefunctionlibrary.#./etc/init......
  • 计算机内存不足,若要还原足够的内存以使程序正常工作,请保存文件,然后关闭或重新启动所有
    电脑提示计算机内存不足,若要还原足够的内存以使程序正常工作,请保存文件,然后关闭或重新启动所有打开的程序。遇到这种问题其实是因为没有设置虚拟内存或者设置太小了 1、更改虚拟内存的操作,在桌面上右键单击计算机,选择属性;2、选择高级系统设置,弹出系统属性窗口;3、直接定位到......
  • wsl无法启动docker
    报错信息failedtostartdaemon:Errorinitializingnetworkcontroller:errorobtainingcontrollerinstance:unabletoaddreturnruleinDOCKER-ISOLATION-STAGE-1chain:(iptablesfailed:iptables--wait-ADOCKER-ISOLATION-STAGE-1-jRETURN:iptablesv1.8.7......