《走进科学》灵异事件:Nginx配置改了之后一直报错
想要安装WoWSimpleRegistration,就定下来要用nginx+php8 ,结果nginx那里加上php的支持之后一直报错:
$ sudo service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.
最灵异的地方就是:将配置恢复成今天修改之前的,还是同样的报错。简直是《走进科学》IT版。
当然用sudo systemctl status nginx.service看,报错还是不一样的。
自己写php配置后的报错:
× nginx.service - A high performance web server and a reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)Active: failed (Result: exit-code) since Thu 2024-02-08 07:53:31 UTC; 11s agoDocs: man:nginx(8)Process: 47195 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)CPU: 28msFeb 08 07:53:31 ub systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 08 07:53:31 ub nginx[47195]: nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/conf.d/wow>
Feb 08 07:53:31 ub nginx[47195]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 08 07:53:31 ub systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Feb 08 07:53:31 ub systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 08 07:53:31 ub systemd[1]: Failed to start A high performance web server and a reverse proxy server.
现在恢复配置之后的报错:
× nginx.service - A high performance web server and a reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)Active: failed (Result: exit-code) since Thu 2024-02-08 06:33:07 UTC; 1h 9min agoDocs: man:nginx(8)Process: 29162 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)Process: 29163 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)CPU: 86msFeb 08 06:33:05 ub nginx[29163]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Feb 08 06:33:05 ub nginx[29163]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Feb 08 06:33:06 ub nginx[29163]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Feb 08 06:33:06 ub nginx[29163]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Feb 08 06:33:06 ub nginx[29163]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
Feb 08 06:33:06 ub nginx[29163]: nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
Feb 08 06:33:07 ub nginx[29163]: nginx: [emerg] still could not bind()
Feb 08 06:33:07 ub systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Feb 08 06:33:07 ub systemd[1]: nginx.service: Failed with result 'exit-code'.
Feb 08 06:33:07 ub systemd[1]: Failed to start A high performance web server and a reverse proxy server.
这样就看明白了,是80端口绑定报错。然后脑子突然在线了,是不是今天调试的时候,把apache安装上去了? 打开本地页面http://127.0.0.1 ,果然是apache的页面。原来这就是nginx恢复配置也无法启动的原因啊!
把apache服务停掉:sudo systemctl stop apache2
然后再开nginx的服务:sudo service nginx restart
没有报错了! 好,现在开始调试php吧!
再仔细看php的报错:
skywalk@ub:/etc/nginx$ journalctl -xeu nginx.service
Feb 08 10:30:55 ub nginx[49977]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 08 10:30:55 ub systemd[1]: nginx.service: Control process exited, code=exited, status=1/F>
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ An ExecStartPre= process belonging to unit nginx.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 1.
Feb 08 10:30:55 ub systemd[1]: nginx.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Feb 08 10:30:55 ub systemd[1]: Failed to start A high performance web server and a reverse pr>
░░ Subject: A start job for unit nginx.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░
░░ A start job for unit nginx.service has finished with a failure.
░░
░░ The job identifier is 7021 and the job result is failed.
使用nginx -t查看:
$ sudo nginx -t
nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/nginx/conf.d/wow.conf:18
nginx: configuration file /etc/nginx/nginx.conf test failed
定位到18行 ,但是没有问题啊,括号是成对的啊,所有的语句后面都有分号。
再仔细查看,发现最后第18行,有一个“~”字符,由于它跟vi的显示字符一样(颜色不同),误以为第18行是空行,将其删除,ok拉!
现在http服务器起来了,但是php服务还没起来。 手动写index.php 文件,结果没执行,被下载下来了
怀疑是php-fpm服务没有起来,手工起,结果失败:
sudo systemctl start php-fpm
Failed to start php-fpm.service: Unit php-fpm.service not found.
先查看apt有没有安装
$ sudo apt list |grep fpmWARNING: apt does not have a stable CLI interface. Use with caution in scripts.libfpm-helper0/jammy 4.2-2.3 amd64
libintelrdfpmath-dev/jammy 2.0u2-4 amd64
mono-fpm-server/jammy,jammy 4.2-2.3 all
php-fpm/jammy,jammy,now 2:8.1+92ubuntu1 all [installed]
php8.1-fpm/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
php8.1-fpm/jammy-updates,jammy-security 8.1.2-1ubuntu2.14 i386
再查看service
$ sudo systemctl list-units --type=service | grep phpphp8.1-fpm.service
loaded active running The PHP 8.1 FastCGI Process Manager
启动:
$ sudo systemctl start php8.1-fpm
现在php-fpm总算启动了
php8.1-fpm.service │ ├─17901 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)│ ├─17904 php-fpm: pool www│ └─17905 php-fpm: pool www
发现这条语句没有: fastcgi_index index.php;
加上之后照旧,就像php没有起来一样。
比着这个来一下:
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
现在的浏览器报错是:403 Forbidden
又问了一遍文心一言,这回对该回答比较满意,只修改了域名了目录,一次过!
server {listen 80;server_name wow.airoot.org;root /var/www/; index index.php index.html index.htm;location / { try_files $uri $uri/ =404;} location ~ \.php$ { fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; # 根据你的 PHP-FPM 配置修改 fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht {deny all; }
}
现在把wow reg下载到目录,
配置好后,提示:Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0".
当前版本:PHP 8.1.2
升级到8.2 并不太顺利,当前apt包里是没有的,网上找到的操作:
sudo dpkg -l | grep php | tee packages.txt
sudo add-apt-repository ppa:ondrej/php # Press enter when prompted.
sudo apt update
sudo apt install php8.2 php8.2-cli php-8.2{bz2,curl,mbstring,intl}sudo apt install php8.2-fpm
# OR
# sudo apt install libapache2-mod-php8.2sudo a2enconf php8.2-fpm# When upgrading from older PHP version:
sudo a2disconf php8.1-fpm## Remove old packages
sudo apt purge php8.1*
安装的时候提示:
CAVEATS:
1. If you are using php-gearman, you need to add ppa:ondrej/pkg-gearman
2. If you are using apache2, you are advised to add ppa:ondrej/apache2
3. If you are using nginx, you are advised to add ppa:ondrej/nginx-mainline
or ppa:ondrej/nginx
新版本浏览器报错:
502 Bad Gateway
看/var/nginx/error.log :
024/02/09 01:38:13 [crit] 40709#40709: *1 connect() to unix:/var/run/php/php8.1-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 192.168.0.107, server: wow.airoot.org, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "wow.airoot.org"
~
是php-fpm文件没有改过来。
将conf文件中fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;修改为fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
报错没有文件:
启动php8.3-fpm :
sudo systemctl start php8.3-fpm
这时候打开http://wow.airoot.org/html/index.php页面是空白,源代码里空。
这样估计有点正常了。将php的测试文件test.php
<?php
phpinfo();?>
放入根目录,测试通过.
查看WoWSimpleRegistration手册:
-
Fulfill the above prerequisites on your server.
-
Obtain the project files:
- Download and unzip the project, or clone it using Git:
git clone https://github.com/masterking32/WoWSimpleRegistration
- Download and unzip the project, or clone it using Git:
-
-
Navigate to the
application/config/directory and rename the fileconfig.php.sampletoconfig.php. -
Edit the newly renamed
config.phpfile, inserting your server details. Note that if using the "Image Captcha" feature, PHP's GD2 module must be enabled. -
Once configuration is complete, your registration page should be operational.
下面配置文件就行了。
相关文章:
《走进科学》灵异事件:Nginx配置改了之后一直报错
想要安装WoWSimpleRegistration,就定下来要用nginxphp8 ,结果nginx那里加上php的支持之后一直报错: $ sudo service nginx restart Job for nginx.service failed because the control process exited with error code. See "systemctl…...
Select 选择器 el-option 回显错误 value
离谱 回显的内容不是 label 而是 value 的值 返回官方看说明: v-model的值为当前被选中的el-option的 value 属性值 value / v-model 绑定值有3种类型 boolean / string / number 根据自身代码猜测是:tableData.bookId 与 item.id 类型不一致导致 &…...
【51单片机Keil+Proteus8.9】门锁控制电路
门锁控制电路 二、设计思路 电路设计 1.电源部分:使用BATTERY为整个电路提供电源,可以在电路中加入一个电 源开关,以便控制电源的开启和关闭。 2.处理器部分:使用AT89C51芯片作为主处理器,通过编写程序实现门锁的 …...
比较Kamailio和OpenSIPS的重写contact函数
Kamailio:调用set_contact_alias()之后,在原有的contact的后面增加参数,具体地说,就是网络地址,网络端口和transport,好处是收到后续请求之时可以恢复原有contact的内容(当然也有坏处࿰…...
【ETOJ P1046】斐波那契数列 题解(数学+动态规划)
题目描述 给定一个整数 T T T,表示样例数。 对于每个样例,给定一个整数 n n n,求斐波那契数列的第 n n n 项。 斐波那契数列定义为 f ( 1 ) f ( 2 ) 1 f(1) f(2) 1 f(1)f(2)1, f ( n ) f ( n − 1 ) f ( n − 2 ) f(…...
编码技巧——基于RedisTemplate的RedisClient实现、操作Lua脚本
1. 背景 在新公司的脚手架中开发,需要用到redis,发现没有封装好一套能集成各种常用命令、包括Lua脚本的方便使用的RedisTemplateClient,于是自己来实现下; springboot整合redis之后,提供了操作redis的简便方式&#…...
Asp .Net Core 系列:Asp .Net Core 集成 Panda.DynamicWebApi
文章目录 简介Asp .Net Core 集成 Panda.DynamicWebApi配置原理什么是POCO Controller?POCO控制器原理ControllerFeatureProvider实现自定义判断规则IApplicationModelConventionPanda.DynamicWebApi中的实现ConfigureApiExplorer()ConfigureSelector()ConfigurePar…...
【PTA浙大版《C语言程序设计(第4版)》|编程题】习题7-3 判断上三角矩阵(附测试点)
目录 输入格式: 输出格式: 输入样例: 输出样例: 代码呈现 测试点 上三角矩阵指主对角线以下的元素都为0的矩阵;主对角线为从矩阵的左上角至右下角的连线。 本题要求编写程序,判断一个给定的方阵是否…...
JVM 性能调优 - 参数调优(3)
查看 JVM 内存的占用情况 编写代码 package com.test;public class PrintMemoryDemo {public static void main(String[] args) {// 堆内存总量long totalMemory Runtime.getRuntime().totalMemory();// jvm 试图使用的最大堆内存long maxMemory Runtime.getRuntime().maxM…...
Django(十)
1. Ajax请求 浏览器向网站发送请求时:URL 和 表单的形式提交。 GETPOST 特点:页面刷新。 除此之外,也可以基于Ajax向后台发送请求(偷偷的发送请求)。 依赖jQuery编写ajax代码 $.ajax({url:"发送的地址"…...
OpenHarmony开源鸿蒙开发之旅
文章目录 一、op系统架构二、op系统构建1. op源代码目录2. op系统构建3. op开发环境搭建 三、op系统的子系统四、op系统芯片移植五、op系统启动流程六、op系统组件七、驱动框架 一、op系统架构 二、op系统构建 1. op源代码目录 2. op系统构建 3. op开发环境搭建 三、op系统…...
SpringBoot之整合PageHelper分页插件
SpringBoot之整合PageHelper分页插件 文章目录 SpringBoot之整合PageHelper分页插件1. 引入坐标2. application.yml配置3. 基本使用4. 对多个查询执行分页1. 默认第一个Select语句会执行分页2. 让Pagehelper也能执行多个分页的方法3. 完整案例 详细配置请查看官网或MyBatis分页…...
Android java基础_类的封装
一.面向对象编程的引入 写一个简单的程序输出张三,李四的名字 class Person {String name;String getName() {return "guangdong "name;} };public class Oop {public static void main(String args[]) {Person p1 new Person();p1.name "zhangs…...
Vue-57、Vue技术路由的参数如何传递
query参数传递 1、传递参数 <!-- 跳转路由并携带query参数,to的字符串写法--> <router-link :to"/home/message/detail?id${p.id}&title${p.title}"> {{p.title}} </router-link><!-- 跳转路由…...
《MySQL 简易速速上手小册》第1章:MySQL 基础和安装(2024 最新版)
文章目录 1.1 MySQL 概览:版本、特性和生态系统1.1.1 基础知识1.1.2 重点案例:使用 Python 实现 MySQL 数据的 CRUD 操作1.1.3 拓展案例 1:使用 Python 实现 MySQL 数据备份**1.1.4 拓展案例 2:使用 Python 分析 MySQL 数据 1.2 安…...
Linux 软件管理(YUM RPM)
1 YUM yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次…...
【Makefile语法 05】动静态库编译链接
目录 一、多文件项目源代码 二、静态库编译链接 三、动态库编译链接 一、多文件项目源代码 // include/add.hpp#pragma once int add(int a, int b); // include/sub.hpp#pragma once int sub(int a, int b); // src/add.cpp#include "add.hpp"int add(int a, …...
JS - 处理元素滚动
业务功能中时常有元素滚动的功能,现在就总结一下一些常用的事件。 一、定位滚动元素 做一切滚动操作之前都应该先定位到滚动元素,再做其他操作,如滚动顶部,获取滚动距离、禁止滚动等。 把以下代码复制粘贴到浏览器 Console 面板…...
JavaScript滚动事件
🧑🎓 个人主页:《爱蹦跶的大A阿》 🔥当前正在更新专栏:《VUE》 、《JavaScript保姆级教程》、《krpano》、《krpano中文文档》 ✨ 前言 滚动是网页交互不可或缺的一部分。监听页面和元素的滚动事件,可以帮助…...
4.0 Zookeeper Java 客户端搭建
本教程使用的 IDE 为 IntelliJ IDEA,创建一个 maven 工程,命名为 zookeeper-demo,并且引入如下依赖,可以自行在maven中央仓库选择合适的版本,介绍原生 API 和 Curator 两种方式。 IntelliJ IDEA 相关介绍:…...
eNSP-Cloud(实现本地电脑与eNSP内设备之间通信)
说明: 想象一下,你正在用eNSP搭建一个虚拟的网络世界,里面有虚拟的路由器、交换机、电脑(PC)等等。这些设备都在你的电脑里面“运行”,它们之间可以互相通信,就像一个封闭的小王国。 但是&#…...
对WWDC 2025 Keynote 内容的预测
借助我们以往对苹果公司发展路径的深入研究经验,以及大语言模型的分析能力,我们系统梳理了多年来苹果 WWDC 主题演讲的规律。在 WWDC 2025 即将揭幕之际,我们让 ChatGPT 对今年的 Keynote 内容进行了一个初步预测,聊作存档。等到明…...
srs linux
下载编译运行 git clone https:///ossrs/srs.git ./configure --h265on make 编译完成后即可启动SRS # 启动 ./objs/srs -c conf/srs.conf # 查看日志 tail -n 30 -f ./objs/srs.log 开放端口 默认RTMP接收推流端口是1935,SRS管理页面端口是8080,可…...
CMake 从 GitHub 下载第三方库并使用
有时我们希望直接使用 GitHub 上的开源库,而不想手动下载、编译和安装。 可以利用 CMake 提供的 FetchContent 模块来实现自动下载、构建和链接第三方库。 FetchContent 命令官方文档✅ 示例代码 我们将以 fmt 这个流行的格式化库为例,演示如何: 使用 FetchContent 从 GitH…...
Android Bitmap治理全解析:从加载优化到泄漏防控的全生命周期管理
引言 Bitmap(位图)是Android应用内存占用的“头号杀手”。一张1080P(1920x1080)的图片以ARGB_8888格式加载时,内存占用高达8MB(192010804字节)。据统计,超过60%的应用OOM崩溃与Bitm…...
OPENCV形态学基础之二腐蚀
一.腐蚀的原理 (图1) 数学表达式:dst(x,y) erode(src(x,y)) min(x,y)src(xx,yy) 腐蚀也是图像形态学的基本功能之一,腐蚀跟膨胀属于反向操作,膨胀是把图像图像变大,而腐蚀就是把图像变小。腐蚀后的图像变小变暗淡。 腐蚀…...
LINUX 69 FTP 客服管理系统 man 5 /etc/vsftpd/vsftpd.conf
FTP 客服管理系统 实现kefu123登录,不允许匿名访问,kefu只能访问/data/kefu目录,不能查看其他目录 创建账号密码 useradd kefu echo 123|passwd -stdin kefu [rootcode caozx26420]# echo 123|passwd --stdin kefu 更改用户 kefu 的密码…...
面向无人机海岸带生态系统监测的语义分割基准数据集
描述:海岸带生态系统的监测是维护生态平衡和可持续发展的重要任务。语义分割技术在遥感影像中的应用为海岸带生态系统的精准监测提供了有效手段。然而,目前该领域仍面临一个挑战,即缺乏公开的专门面向海岸带生态系统的语义分割基准数据集。受…...
【Nginx】使用 Nginx+Lua 实现基于 IP 的访问频率限制
使用 NginxLua 实现基于 IP 的访问频率限制 在高并发场景下,限制某个 IP 的访问频率是非常重要的,可以有效防止恶意攻击或错误配置导致的服务宕机。以下是一个详细的实现方案,使用 Nginx 和 Lua 脚本结合 Redis 来实现基于 IP 的访问频率限制…...
CSS | transition 和 transform的用处和区别
省流总结: transform用于变换/变形,transition是动画控制器 transform 用来对元素进行变形,常见的操作如下,它是立即生效的样式变形属性。 旋转 rotate(角度deg)、平移 translateX(像素px)、缩放 scale(倍数)、倾斜 skewX(角度…...
