Nginx
(40)EMQX MQTT 服务配置 WSS 证书
## 为何要配置 WSS 证书
原本用 EMQX 内置的 8083 端口,就可以实现 mqtt over websocket。
例如,地址:
```
ws://www.sunzhongwei.com:8083/mqtt
`
nginx 中禁用 css, js,图片等静态资源的日志记录
对于网站的 nginx 日志,三分之二以上是 css js 及图片等静态文件的访问日志。
## 禁用静态文件日志的好处
- 提升 IO 性能,避免无意义的写入磁盘操作
- 便于实时查看 nginx 日志
## 禁用方法
修
ubuntu 20.04 禁止 apache 开机自启动
ubuntu 20.04 server 重启之后,发现 nginx 没有自启动。
而手动启动 nginx,报错,显示 80 端口被占用。
```
$ sudo nginx
[sudo] password for xxx:
certbot 安装证书报错:The requested nginx plugin does not appear to be installed
## 系统环境
Ubuntu 20.04
## 报错信息
```
# certbot --nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log
The
Nginx 多配置文件放哪个目录好,sites-available/enabled 与 conf.d 对比
从 nginx.conf 的 http block 配置来看,ubuntu 20.04 apt 安装的 nginx 默认引入了两个配置目录:
```
include /etc/nginx/conf.d/*.conf;
includ
ubuntu 20.04 apt install nginx-core/light/full 的区别
在新购的服务器系统 Ubuntu 20.04 上部署生产环境。想通过 apt 安装 nginx,发现提示中有N个选项:
```
$ nginx
Command 'nginx' not found, but can be ins
设置 Nginx 规则以屏蔽指定 User Agent 的网站爬虫
晚上我的一个 wordpress 网站再一次被可恶的爬虫爬挂了。。。
对方疯狂的爬取网页,且瞬间并发无数个请求,丝毫不考虑我这孱弱的阿里云低配服务器的小身板能否承受住。不出意外,我的网站挂掉了。。。
没办法,必须得处理一下。
certbot 自动配置 HTTPS 证书时,指定 nginx 配置文件路径
今天在一台 CentOS 7.3 的服务器上配置新网站域名的 HTTPS 证书,Web Server 用的 Nginx。
certbot 提示 nginx.conf 文件找不到。
```
# certbot --nginx
kangle 的基本配置
## 查看 kangle 的版本号
```
/vhs/kangle/bin/kangle -v
kangle/3.5.8(free) build with support: ipv6 ssl[SN] large-file http2
查找 apache 配置文件的位置
首先确认 apache 进程的启动目录
```
ps axuw | grep apache
/www/server/apache/bin/httpd -k start
```
执行:
```
/www/server