随笔分类 - nginx
摘要:一,命令行: # groupadd www # useradd -r -g www -s /sbin/nologin www -r:创建一个系统用户。 -g www:将用户添加到www组。 -s /sbin/nologin:禁止用户登录。 使用 -r 参数创建的账号会自动分配一个系统范围内的用户I
阅读全文
摘要:一,nginx的配置 # 如果没有Upgrade头,则$connection_upgrade为close,否则为upgrade map $http_upgrade $connection_upgrade { default upgrade; '' close; } upstream backend_
阅读全文
摘要:一,报错信息 web nginx[55459]: nginx: [warn] low address bits of 10.8.0.14/24 are meaningless in /opt/soft/nginx/conf/conf.d/adm.conf:52 原因: 这个问题只是因为写命令时没有严
阅读全文
摘要:一,nginx的配置文件 例子: server { listen 443 ssl; listen 1597 ssl; server_name adm.laowang.com; root /web/site/public; index index.php; access_log /logs/adm/a
阅读全文
摘要:一,启动应用: 1,编译程序 $ go build 2,用nohup启动应用的二进制程序 $ nohup /data/goapp/industry/industry >> /data/logs/gologs/back.log 2>&1 & [1] 4896 3,检查应用是否启动: $ ss -lnt
阅读全文
摘要:一,配置 nginx 1,一个nginx的server段 在server段之外添加: map $http_upgrade $connection_upgrade { default upgrade; '' close; } 在server段中添加如下内容: location /index.php {
阅读全文
摘要:一,nginx配置:只允许get/post方法访问 配置规则: location / { if ($request_method !~ ^(GET|POST)$ ) { return 403; } ... } 效果:使用PUT等非GET/POST方法 二,modsecurity配置: 只允许get/
阅读全文
摘要:一,客户端浏览器报错: nginx 503 Service Temporarily Unavailable 问题的原因: http下: limit_req_zone $binary_remote_addr zone=peripreq:20m rate=10r/s; 此server下: limit_r
阅读全文
摘要:一,关于limit_req和limit_conn的区别 what is the difference between connection and request? connection是连接,即常说的tcp连接,通过三次握手而建立的一个完整状态机。建立一个连接,必须得要三次握手。断开连接时要有四次
阅读全文
摘要:一,nginx限流有哪些? 目前来说在nginx上面我们常见的三种限速操作分别是:限制请求数(request)、限制连接数(connection)、限制响应速度(rate),对应在nginx的模块相关指令分别是limit_req、limit_conn和limit_rate三个系列 二,limit_c
阅读全文
摘要:一,以固定的速度提供服务 语法: 例子 limit_req_zone $binary_remote_addr zone=test:10m rate=2r/s; server { location / { limit_req zone=test; }} 语法: imit_req_zone 用于设置限流
阅读全文
摘要:一,指定默认server可以用default_server 当用户访问到了服务器,但与nginx配置文件中的所有server都匹配不上时,则需要访问一个默认的server server { server_name _; listen 80 default_server; listen 443 ssl
阅读全文
摘要:一,设置nginx的日志格式: 1,编辑nginx.conf [root@blog conf]# vi nginx.conf 说明:比默认设置只是在末尾增加了 $request_time 一项 log_format main '$remote_addr - $remote_user [$time_l
阅读全文
摘要:一,modsecurity官网: 官网: https://modsecurity.org/ 如图: 官方代码站: https://github.com/owasp-modsecurity/ModSecurity 二,安装环境准备: 1,安装依赖库: [root@localhost source]#
阅读全文
摘要:一,解析日志得到访问量最高的100个ip地址: awk '{print $1}' www.access_log | sort | uniq -c | sort -n -k 1 -r | head -n 100 效果如图: 二,解析日志得到访问量最高的10个url 命令 [root@blog 27]#
阅读全文
摘要:一,关闭nginx的版本显示: 1,关闭前 2,关闭nginx版本显示: 编辑nginx.conf [root@blog conf]# vi nginx.conf 增加一行: server_tokens off; 重新服务: [root@blog conf]# systemctl reload ng
阅读全文
摘要:一,报错信息: 访问网站时报错:如图: 查看nginx的错误日志: 2023/06/16 10:21:46 [error] 416087#0: *71148 upstream sent too big header while reading response header from upstrea
阅读全文
摘要:一,配置nginx虚拟主机 1,查看php-fpm使用的端口: [root@img ~]# ss -lntp | grep php 如图: 可以看到端口是9000 2,配置虚拟主机: 如下: [root@img conf.d]# vi file.conf 内容如下: server { listen
阅读全文
摘要:一,配置nginx.conf 进入到nginx的conf目录 [root@img conf]# pwd /usr/local/soft/nginx-1.24.0/conf 创建虚拟主机的存放目录 [root@img conf]# mkdir conf.d 编辑配置文件 [root@img conf]
阅读全文
摘要:一,官网: http://nginx.org/ 如图: 二,下载并解压 下载: [root@img nginx]# wget http://nginx.org/download/nginx-1.24.0.tar.gz 解压: [root@img nginx]# tar -zxvf nginx-1.2
阅读全文
浙公网安备 33010602011771号