ubuntu 安装两个nginx实例时的坑,非默认nginx实例配置修改总也不生效的问题

news2024/12/27 12:45:18

一、问题

      由于工作需求xx云服务器上安装了两个nginx实例,突然有一天需要在非默认nginx上增加一个子站点,根据网上教程和原来的记录修改vi nginx.conf 后保存载总也不生效?

   怎么破?

二、过程记录

   假如:非默认nginx安装在  /usr/local/nginx

 那么我 第一步:cd 到/usr/local/nginx

            第二步:nginx -s reload

            第三步:sbin/nginx -c conf/nginx.conf

理论上是没有错的,初始没有任务效果

  三、解决要点

      我们始终要头脑清醒,不管当前在什么目录,默认命令肯定是招待默认实例

  即便当前目标是 非默认实例nginx路径,如果不指定路径,直接键入 nginx命令依然指向默认实例

   所以:

   

   假如:非默认nginx安装在  /usr/local/nginx

 那么我 第一步:cd 到/usr/local/nginx

            第二步: ./nginx -s reload

            第三步:sbin/nginx -c conf/nginx.conf

指定相对路径nginx路径配置生效:
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx/sbin# ./nginx -s reload
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx# sbin/nginx -c conf/nginx.conf


--------------------------------
ot@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx/sbin# nginx -s reload
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx/sbin# ./nginx -s reload
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx/sbin# ./nginx -c ./conf/nginx.conf
nginx: [emerg] mkdir() "./html/hls" failed (2: No such file or directory)
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx/sbin# ./nginx -c ../conf/nginx.conf
nginx: [emerg] open() "/usr/local/nginx/../conf/nginx.conf" failed (2: No such file or directory)
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx/sbin# cd ../
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx# ls
client_body_temp  conf  fastcgi_temp  html  logs  proxy_temp  sbin  scgi_temp  uwsgi_temp
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx# sgin/nginx -c conf/nginx.conf
-bash: sgin/nginx: No such file or directory
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx# sbin/nginx -c conf/nginx.conf
nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1110 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1111 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1112 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1113 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1114 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1115 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1116 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1117 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1118 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1119 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8022 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1110 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1111 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1112 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1113 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1114 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1115 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1116 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1117 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1118 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1119 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8022 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1110 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1111 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1112 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1113 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1114 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1115 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1116 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1117 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1118 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1119 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8022 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1110 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1111 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1112 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1113 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1114 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1115 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1116 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1117 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1118 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1119 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8022 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1935 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1110 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1111 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1112 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1113 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1114 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1115 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1116 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1117 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1118 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:1119 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:8022 failed (98: Address already in use)
nginx: [emerg] still could not bind()
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx# telnet 127.0.0.1 1116
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Connection closed by foreign host.
root@iZuf644aq2mn3ba0k4ain8Z:/usr/local/nginx# 

要点是 第二步 “./”        

    第二步: ./nginx -s reload

只有增加"./" 才是指向实际 指定路径的 nginx  只要不加 “./” 或类似等同的路径限定符,都是默认nginx实例 nginx -s reload 兄弟们就是执行N次都是依然不生效

四、总结

          多nginx实例 时要点是 除了 默认实例外,始终要有路径限定符的概念,不可大意,不要迷糊,在此备忘,同时希望可以帮到兄弟们!不是能力问题,是实践问题!

五、拓展

     同理,我们默认控制nginx 开,关,状态查询命令,如下命令,如果不指定路径限定符,始终是默认实例状态,开,停,而不是非默认实例,

     systemctl  status  nginx 

    systemctl start nginx

   systemctl stop nginx 

  我们即要习惯默认实例的常用 命令,也要适应多个实例,非默认实例的路径限定关系

   正常的步骤应当是

cd 到/usr/local/nginx

    systemctl  status  ./nginx 

    systemctl start ./nginx

   systemctl stop ./nginx 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2054787.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

HanLP分词的使用与注意事项

1 概述 HanLP是一个自然语言处理工具包&#xff0c;它提供的主要功能如下&#xff1a; 分词转化为拼音繁转简、简转繁提取关键词提取短语提取词语自动摘要依存文法分析 下面将介绍其分词功能的使用。 2 依赖 下面是依赖的jar包。 <dependency><groupId>com.ha…

使用SSH协议远程连接Ubuntu

1.切换到root用户 sudo -i 2.安装openssh-server apt update apt install openssh-server 3.启动ssh服务 service ssh start 4.查看ssh状态 &#xff08;q键: 退出&#xff09; service ssh status 5.检查ssh服务是否启动成功 ps -e | grep ssh 6.开机自启动 systemctl enable …

基于STM32F103的FreeRTOS系列(九)·任务创建函数的使用·静态方法和动态方法

目录 1. 前期准备 1.1 中断文件修改 1.2 SysTick文件修改 1.3 任务创建函数API 2. 任务创建&#xff08;静态方法&#xff09; 2.1 创建两个任务函数 2.2 静态创建开始任务函数 2.3 创建开始任务的任务函数 2.4 补充 2.5 代码 3. 任务创建&#xff08;动…

【python基础】—利用pandas读取或写入mysql表数据

文章目录 一、read_sql()二、to_sql()三、连接数据库方式—MySQL1、用sqlalchemy包构建数据库链接2、用DBAPI构建数据库链接 四、容易遇到的问题 一、read_sql() 功能 将 SQL 查询/数据库表读入 DataFrame。 语法 读取数据库&#xff08;通过SQL语句或表名&#xff09; pand…

【书生大模型实战营(暑假场)闯关材料】基础岛:第4关 InternLM + LlamaIndex RAG 实践

基础任务 (完成此任务即完成闯关) 任务要求&#xff1a; 基于 LlamaIndex 构建自己的 RAG 知识库&#xff0c;寻找一个问题 A 在使用 LlamaIndex之前InternLM2-Chat-1.8B模型不会回答&#xff0c;借助 LlamaIndex 后 InternLM2-Chat-1.8B模型具备回答 A 的能力&#xff0c;截图…

SQL-约束篇

在数据库设计中&#xff0c;约束是确保数据完整性和准确性的关键元素。约束可以限制表中数据的类型、范围和关系&#xff0c;从而维护数据的一致性和可靠性。 1. 主键约束 (Primary Key) 主键约束用于唯一标识表中的每一行数据。一个表只能有一个主键&#xff0c;主键字段的值…

计算机毕业设计SpringBoot-VUE-python-nodeJS铁路列车安全管理-评估报告-铁路局-客运-货运-行车-站段-天气情况

1 引言 1.1 项目开发的背景 我国的普铁历史悠久&#xff0c;从19世纪至今已有百来年的历史。新中国以来&#xff0c;铁路的发展速度令人惊叹。但随着发展速度的增快&#xff0c;与之不对应的则是运营安全管理系统的落后。但这些来&#xff0c;我国铁路对于安全的重视程度已经…

代码随想录算法训练营第十六天(二叉树 四)

力扣题部分: 513.找树左下角的值 题目链接:. - 力扣&#xff08;LeetCode&#xff09; 题面: 给定一个二叉树的 根节点 root&#xff0c;请找出该二叉树的 最底层 最左边 节点的值。 假设二叉树中至少有一个节点。 思路(层序遍历): 应该是这道题最简单的方法了&#xff0…

超文本文档HTML

简单的个人网站 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>欢迎来到我的主页</title> &…

【HarmonyOS】鸿蒙应用蓝牙功能实现 (二)

【HarmonyOS】鸿蒙应用蓝牙功能实现 &#xff08;二&#xff09; 前言 蓝牙一般分为传统蓝牙(BR/EDR)&#xff0c;低功耗蓝牙(BLE)两种。 鸿蒙将蓝牙的功能模块分的非常细。 基本上我们会用到access进行蓝牙状态的开启和关闭&#xff0c;以及状态查询。 在使用connection进…

BUUCTF PWN wp--warmup_csaw_2016

第一步 先checksec一下&#xff08;没有启用NX保护、PIE、完整的RELRO和栈保护&#xff0c;还有具有RWX权限的内存段。&#xff09; 分析一下这个文件的保护机制&#xff1a; Arch: amd64-64-little 这表示该可执行文件是为64位的AMD64架构编译的&#xff0c;并且使用的是小…

科大讯飞飞凡计划面经(2024年秋招新出炉)

7月笔完一个多月约的面试 —————————————- 一面8.16 不问项目&#xff0c;上来就是八股轰炸 c11新特性 shared_ptr是线程安全的吗&#xff0c;不安全的话怎么实现线程安全的 stl容器中频繁查找用什么&#xff0c;频繁增删用什么 vector中间插入元素会发生什么&…

NVIDIA Isaac Lab 入门教程(一)

系列文章目录 前言 Isaac Lab 是一个用于机器人学习的统一模块化框架&#xff0c;旨在简化机器人研究中的常见工作流程&#xff08;如 RL、从演示中学习和运动规划&#xff09;。它建立在英伟达 Isaac Sim 的基础上&#xff0c;利用最新的仿真功能实现逼真的场景和快速高效的仿…

74、docker容器编译安装lnmp

一、docker部署lnmp l linux n nginx 1.22 172.111.0.10 docker–nginx m mysql 8.0.30 172.111.0.20 docker–mysql p php 8.1.27 172.111.0.30 docker–php docker&#xff1a;单节点部署&#xff0c;在一台机器上部署&#xff0c;跨了机器容器无法通信&#xff0c;做高…

git 如何生成sshkey公钥

打开git客户端 输入 ssh-keygen -t rsa -b 4096 -C "xxxxxxexample.com" 然后根据提示按enter 或者y 直到出现下图所示 打开 c盘的路径下的文件&#xff0c;/c/Users/18159/.ssh/id_rsa.pub 将id_rsa.pub中的公钥贴到git 网站上的SSH keys即可

网络编程(TCP/UDP)

网络编程 一.网络编程 1.1 概述 ​ Java是 Internet 上的语言&#xff0c;它从语言级上提供了对网络应用程序的支持&#xff0c;程序员能够很容易开发常见的网络应用程序。 ​ Java提供的网络类库&#xff0c;可以实现无痛的网络连接&#xff0c;联网的底层细节被隐藏在Java…

【Hot100】LeetCode—2. 两数相加

目录 1- 思路思路 2- 实现⭐2. 两数相加——题解思路 3- ACM 实现 原题连接&#xff1a;2. 两数相加 1- 思路 思路 分为几个步骤 ①数据结构&#xff1a;遍历指针,进位符、②遍历两个链表、③处理最后的进位符 1- 数据结构 定义 curA 和 curB 用来遍历两个链表定义 carry 记…

ubuntu22.04新机器安装五笔wb、onlyoffice、pyenv、pipenv和虚拟环境virtualenv

wb安装方法 重新开机后右上角点击输入法&#xff0c;在下面打开的界面可以点击配置 左下角shift可快速切换五笔和英文 输入 johnjohn-hp:~$ sudo apt-get install fcitx-table-wbpy johnjohn-hp:~$ sudo apt-get install fcitx-googlepinyin johnjohn-hp:~$ sudo apt-get ins…

二叉树OJ刷题与讲解

1.单值二叉树 题目链接&#xff1a;单值二叉树 题目描述&#xff1a; 这道题要求判断是否是单值二叉树也就是说每个节点的值都要相等才是单值二叉树&#xff0c;如果相等就返回true否则返回false&#xff0c;我们可以使用递归来解这道题&#xff0c;我们把它分为根左子树右子…

Bean对象生命周期流程图

Bean生命周期流程图&#xff1a;https://www.processon.com/view/link/5f8588c87d9c0806f27358c1 Spring扫描底层流程&#xff1a;https://www.processon.com/view/link/61370ee60e3e7412ecd95d43