Peak Xin

小峰的博客


  • 首页

  • 标签

  • 分类

  • 归档

  • 优秀资源

  • 搜索

LNMP环境 Nginx 502 Bad Gateway错误可能原因及解决方法

发表于 2021-06-02 | 分类于 运维 |
字数统计: 1.1k | 阅读时长 ≈ 4

在使用lnmp环境时,偶尔会遇到nginx返回502错误,这里我以lnmp一键安装进行说明

原因一:安装时php没有安装成功

查看一下是否存在/usr/local/php/sbin/php-fpm,如果没有肯定没安装成功。

原因二:eaccelerator配置项

在php.ini里,eaccelerator配置项一定要放在Zend Optimizer配置之前,否则也可能引起502 Bad Gateway。php一些模块之间也可能会造成502,如Zend GuardLoader与Opcache,ioncube与Zend GuardLoader等,一般可以通过注释掉一个然后重启php-fpm,然后看是否还502进行排除。

原因三:php-cgi进程

在安装好使用过程中出现502问题,一般是因为默认php-cgi进程是5个,可能因为phpcgi进程不够用而造成502,需要修改/usr/local/php/etc/php-fpm.conf 将其中的max_children值适当增加,如果php已升级到5.3.*以上且使用的是dynamic模式,需要调整pm.min_spare_servers和pm.max_spare_servers的值适当增加。

阅读全文 »

CentOS6.5配置阿里云yum源后报错 http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml The requested URL returned error: 404 Not Found

发表于 2021-05-25 | 分类于 运维 |
字数统计: 225 | 阅读时长 ≈ 1

CentOS6.5在配置阿里云yum源后,更新缓存发生报错

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@localhost yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: (28, 'connect() timed out!')
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 - "Couldn't resolve host 'mirrors.cloud.aliyuncs.com'"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
阅读全文 »

解决Git冲突:Please commit your changes or stash them before you can merge

发表于 2021-05-21 | 分类于 版本管理 |
字数统计: 455 | 阅读时长 ≈ 1

服务器更新代码git pull的时候有冲突

1
2
3
4
5
6
7
Updating 6517e7c..d208dd9
error: Your local changes to the following files would be overwritten by merge:
api/common.php
app/portal/model/ReservationModel.php
composer.lock
Please, commit your changes or stash them before you can merge.
Aborting

出现这个问题的原因是版本库提交了新代码,而你服务器也修改了对应文件的代码,
这时候你进行git pull操作就好出现冲突了,解决方法,在上面的提示中也说的很明确了。

阅读全文 »

安装 closurecompiler@1.6.1 失败

发表于 2021-04-13 | 分类于 Nodejs |
字数统计: 446 | 阅读时长 ≈ 2

在安装grunt的时候,提示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
$ cnpm i
√ Installed 8 packages
√ Linked 53 latest versions
[1/1] scripts.install grunt-closurecompiler@0.9.9 ? closurecompiler@>=1.2 run "npm run-script configure", root: "D:\\phpStudy\\PHPTutorial\\WWW\\gdfront\\ueditor_old\\node_modules\\_closurecompiler@1.6.1@closurecompiler"

> closurecompiler@1.6.1 configure D:\phpStudy\PHPTutorial\WWW\gdfront\ueditor_old\node_modules\_closurecompiler@1.6.1@closurecompiler
> node scripts/configure.js

Configuring ClosureCompiler.js 1.6.1 ...

Downloading https://dl.google.com/closure-compiler/compiler-latest.tar.gz ...
? Download failed: Error: Download failed: HTTP status code 404

? Unfortunately, ClosureCompiler.js could not be configured.
See: https://github.com/dcodeIO/ClosureCompiler.js (create an issue maybe)

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! closurecompiler@1.6.1 configure: `node scripts/configure.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the closurecompiler@1.6.1 configure script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Caffrey\.npminstall_tarball\_logs\2021-04-13T06_53_17_040Z-debug.log
[npminstall:runscript:error] grunt-closurecompiler@0.9.9 ? closurecompiler@>=1.2 scripts.install run "npm run-script configure" error: Error [RunScriptError]: Run "C:\Windows\system32\cmd.exe /d /s /c npm run-script configure" error, exit code 1
at ChildProcess.<anonymous> (D:\nvm\v12.18.0\node_modules\cnpm\node_modules\runscript\index.js:96:21)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5) {
stdio: [Object],
exitcode: 1
}
× Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "C:\Windows\system32\cmd.exe /d /s /c npm run-script configure" error, exit code 1
RunScriptError: Run "C:\Windows\system32\cmd.exe /d /s /c npm run-script configure" error, exit code 1
at ChildProcess.<anonymous> (D:\nvm\v12.18.0\node_modules\cnpm\node_modules\runscript\index.js:96:21)
at ChildProcess.emit (events.js:315:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
npminstall version: 3.28.0
npminstall args: D:\Program Files\nodejs\node.exe D:\nvm\v12.18.0\node_modules\cnpm\node_modules\npminstall\bin\install.js --fix-bug-versions --china --userconfig=C:\Users\Caffrey\.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org
阅读全文 »

JS点击空白处关闭弹窗方法

发表于 2021-03-11 | 分类于 前端开发 , JavaScript |
字数统计: 521 | 阅读时长 ≈ 2

第一种 jQuery 写法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<html lang="en" style="width: 100%;height: 100%;">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style type="text/css">
html,
body {
width: 100%;
height: 100%;
border: 0;
margin: 0;
}

.dialog {
width: 100%;
height: 100%;
position: relative;
background: rgba(0, 0, 0, 0.1);
}

.dialog .dialog-content {
width: 200px;
border: 1px solid #eeeeee;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #FFF;
box-shadow: 1px 1px 10px #888888;
text-align: center;
line-height: 100px;
}
</style>
<body style="width: 100%;height: 100%;">
<div class="dialog">
<div class="dialog-content">
<p>这是弹窗</p>
</div>
</div>
<script src="https://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).mouseup(function(e) {
var dc = $('.dialog-content'); // 目标区域,弹窗内容区域
// 如果点击的 不是目标区域 并且 不是目标区域的子元素
if (!dc.is(e.target) && dc.has(e.target).length === 0) {
// some code...
$('.dialog').hide();
}
});
</script>
</body>

</html>

判断点击事件发生在区域外的条件是:

  • 点击事件的对象不是目标区域本身
  • 事件对象同时也不是目标区域的子元素
阅读全文 »

百度编辑器UEditor去除复制样式实现无格式粘贴

发表于 2021-02-19 | 分类于 前端框架 , 编辑器 |
字数统计: 507 | 阅读时长 ≈ 2

百度编辑器UEditor内置了无格式粘贴功能,只需要对ueditor/ueditor.config.js文件简单的配置即可。

  1. 开启retainOnlyLabelPasted,设置为true
1
2
//粘贴只保留标签,去除标签所有属性
,retainOnlyLabelPasted: true
  1. 开启pasteplain,设置为true
1
,pasteplain:true  //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
阅读全文 »

百度编辑器UEditor增加字间距工具按钮

发表于 2021-02-19 | 分类于 前端框架 , 编辑器 |
字数统计: 914 | 阅读时长 ≈ 4

百度编辑器工具栏中没有字间距工具,在编辑富文本的时候可能会用到字间距设置,这里我们来扩展一个字间距工具。

使用的百度编辑器UEditor版本为ueditor-1.4.3.3

修改语言包

中文

文件ueditor/lang/zh-cn/zh-cn.js在labelMap里面添加'letterspacing':'字间距',

1
'lineheight':'行间距','letterspacing':'字间距','edittip' :'编辑提示','customstyle':'自定义标题', 'autotypeset':'自动排版',
阅读全文 »

H5直播实现方案

发表于 2021-01-26 | 分类于 前端开发 , HTML |
字数统计: 1.8k | 阅读时长 ≈ 6

Demo地址

视频编码格式

  • 视频文件格式(容器格式)
  • 视频编解码器(视频编码格式)
  • 视频一开始由两个端采集,视频输入口、音频输入口。采集的数据会分别进行相关处理,简而言之就是:将视频/音频流通过一定的手段转换为比特流并且压缩,最终,这里将比特流以一定顺序放到一个盒子里进行存放,从而声称我们最终所看到的音视频格式。如:mp3/mp4/flv
阅读全文 »

服务商分账和电商收付通的区别

发表于 2021-01-06 | 分类于 微信开发 , 微信支付 |
字数统计: 40 | 阅读时长 ≈ 1

服务商分账和电商收付通的区别:

  1. 多个店铺商品合并支付
  2. 分账可以到个人微信支付

电商收付通

Error during WebSocket handshake: Unexpected response code: 301 或 302

发表于 2020-12-30 | 分类于 服务器 , 网络通信 |
字数统计: 75 | 阅读时长 ≈ 1

如果服务端没有使用SSL,使用WebSocket

1
websocket = new WebSocket("ws://域名/path");

如果服务端使用SSL,使用WebSocket

1
websocket = new WebSocket("wss://域名/path");

可以理解wss高级了一些,否则会报错误

1
Error during WebSocket handshake: Unexpected response code: 301

或

1
Error during WebSocket handshake: Unexpected response code: 302

1…567…20
Peak Xin

Peak Xin

Always keep a learning heart.

197 日志
41 分类
111 标签
RSS
GitHub E-Mail Twitter StackOverflow GitLab Travis Gitee SegmentFault CSDN
推荐网址
  • 阮一峰的个人网站
  • 廖雪峰的官方网站
  • 韩天峰(Rango)的博客
© 2025 Peak Xin 鲁ICP备15013472号-3
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4
本博客 由 Peak Xin 采用 知识共享 署名 4.0 国际 许可协议进行许可。
站点总访客数: 站点总访问量:
0%