websoft9/apps/roles/role_nginx/Notes.md
2022-09-02 08:59:10 +08:00

55 lines
857 B
Markdown

## set Random Password flow
* cd /etc/nginx
* echo "" > .htpasswd
* sudo sh -c "echo -n 'admin:' >> /etc/nginx/.htpasswd"
* sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd"
* systemctl restart nginx
## NOTICE(human-computer interaction)
* Password:
* Verifying - Password:
* [root@iZj6c5nu6jo58ryap26im7Z nginx]# cat .htpasswd
* admin:$apr1$P8N3u5Q9$bt/HjzBaYvHS5PD.qG67q0
## Nginx settings
The easiest way to configure a performant, secure, and stable NGINX server.
https://www.digitalocean.com/community/tools/nginx
## Nginx support WebSockets
```
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
```
## Nginx location order
```
location 匹配规则顺序:
1. location = /path{
}
2. location ^~ /path{
}
3. location ~ /path{
}
或location ~* /path{
}
4. location /path{
}
5. location /{
}
```