摘要:
#对源站点验证 valid_referers *.demo.com; #非法引入会进入下方判断 if ($invalid_referer) { return 404; } 阅读全文
摘要:
#允许跨域请求的域,*代表所有 add_header 'Access-Control-Allow-Origin' *; #允许带上cookie请求 add_header 'Access-Control-Allow-Credentials' 'true'; #允许请求的方法,比如 GET/POST/P 阅读全文
摘要:
###空格 :默认匹配,普通匹配 location / { root /home; } ###= :精确匹配 location = /imooc/img/face1.png { root /home; } ###~* :匹配正则表达式,不区分大小写 #符合图片的显示 location ~ \.(GI 阅读全文
摘要:
假如服务器路径为:/home/imooc/files/img/face.png root 路径完全匹配访问 配置的时候为: location /imooc { root /home } 用户访问的时候请求为: url:port/imooc/files/img/face.png alias 可以为你的 阅读全文
摘要:
##脚本 ###1. 创建一个shell可执行文件: cut_my_log.sh: #!/bin/bash LOG_PATH="/var/log/nginx/" RECORD_TIME=$(date -d "yesterday" +%Y-%m-%d) PID=/var/run/nginx/nginx 阅读全文
摘要:
nginx -s quit 优雅停止nginx,有连接时会等连接请求完成再杀死worker进程 nginx -s reload 优雅重启,并重新载入配置文件nginx.conf nginx -s reopen 重新打开日志文件,一般用于切割日志 nginx -v 查看版本 nginx -t 检查ng 阅读全文
摘要:
###1. 设置worker进程的用户,指的linux中的用户,会涉及到nginx操作目录或文件的一些权限,默认为 nobody user root; ###2. worker进程工作数设置,一般来说CPU有几个,就设置几个,或者设置为N-1也行 worker_processes 1; ``` ## 阅读全文
摘要:
安装Nginx 1. 去官网http://nginx.org/下载对应的nginx包,推荐使用稳定版本 2. 上传nginx到linux系统 3. 安装依赖环境 (1)安装gcc环境 yum install gcc-c++ (2)安装PCRE库,用于解析正则表达式 yum install -y pc 阅读全文