Nginx location相关配置说明

 
 

  基于不同的IP、不同的端口以及不用得域名实现不同的虚拟主机,依赖于核心模块ngx_http_core_module实现。

新建PC web站点

  1. [root@CentOS7 ~]#mkdir /apps/nginx/conf.d
  2. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  3. server {
  4. listen 80;
  5. server_name www.darius.com;
  6. location / {
  7. root /data/nginx/html/pc;
  8. }
  9. }
  10. [root@CentOS7 ~]#mkdir /data/nginx/html/pc -pv
  11. mkdir: 已创建目录 "/data/nginx"
  12. mkdir: 已创建目录 "/data/nginx/html"
  13. mkdir: 已创建目录 "/data/nginx/html/pc"
  14. [root@CentOS7 ~]#echo "pc web" >>/data/nginx/html/pc/index.html
  15. [root@CentOS7 ~]#tail -2 /apps/nginx/conf/nginx.conf
  16. include /apps/nginx/conf.d/*.conf;
  17. }

加载配置文件

  1. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -t
  2. nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
  3. nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
  4. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

访问测试

  1. 测试机添加一条主机解析
  2. [root@CentOS-Test ~]#cat /etc/hosts
  3. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  4. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  5. 192.168.36.104 www.darius.com
  6. 访问测试
  7. [root@CentOS-Test ~]#curl www.darius.com
  8. pc web

root与alias

  root:指定web的家目录,在定义location的时候,文件的绝对路径等于 root+location

  1. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  2. server {
  3. listen 80;
  4. server_name www.darius.com;
  5. location / {
  6. root /data/nginx/html/pc;
  7. }
  8. location /about {
  9. root /data/nginx/html/pc; # #必须要在pc目录中创建一个about目录才可以访问,否则报错。
  10. index index.html;
  11. }
  12. }
  13. [root@CentOS7 ~]#mkdir /data/nginx/html/pc/about
  14. [root@CentOS7 ~]#echo "/data/nginx/html/pc/about" >>/data/nginx/html/pc/about/index.html

重启测试

  1. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -t
  2. nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
  3. nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
  4. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

访问

  1. [root@CentOS-Test ~]#curl -L www.darius.com/about
  2. /data/nginx/html/pc/about

alias:定义路径别名,会把访问的路径重新定义到其指定的路径

  1. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  2. server {
  3. listen 80;
  4. server_name www.darius.com;
  5. location / {
  6. root /data/nginx/html/pc;
  7. }
  8. location /about { # 使用alias的时候uri后面如果加了斜杠则下面的路径配置必须加斜杠,否则403
  9. #root /data/nginx/html/pc;
  10. alias /data/nginx/html/pc; # 当访问about的时候,会显示alias定义的/data/nginx/html/pc里面的内容。
  11. index index.html;
  12. }
  13. }
  14. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -t
  15. nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
  16. nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
  17. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

访问测试

  1. [root@CentOS-Test ~]#curl -L www.darius.com/about
  2. pc web

location 的使用方法

  在没有使用正则表达式的时候,nginx会先在server中的多个location选取匹配度最高的一个uri,uri是用户请求的字符串,即域名后面的web文件路径,然后使用该location模块中的正则url和字符串,如果匹配成功就结束搜索,并使用此location处理此请求。

  1. 语法规则: location [=|~|~*|^~] /uri/ { }
  2. = #用于标准uri前,需要请求字串与uri精确匹配,如果匹配成功就停止向下匹配并立即处理请求。
  3. ~ #用于标准uri前,表示包含正则表达式并且区分大小写
  4. ~* #用于标准uri前,表示包含正则表达式并且不区分大写
  5. !~ #用于标准uri前,表示包含正则表达式并且区分大小写不匹配
  6. !~* #用于标准uri前,表示包含正则表达式并且不区分大小写不匹配
  7. ^~ #用于标准uri前,表示包含正则表达式并且匹配以什么开头
  8. $ #用于标准uri前,表示包含正则表达式并且匹配以什么结尾
  9. \ #用于标准uri前,表示包含正则表达式并且转义字符。可以转. * ?等
  10. * #用于标准uri前,表示包含正则表达式并且代表任意长度的任意字符

location 精确匹配

  1. [root@CentOS7 ~]#vim /apps/nginx/conf.d/pc.conf
  2. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  3. server {
  4. listen 80;
  5. server_name www.darius.com;
  6. location / {
  7. root /data/nginx/html/pc;
  8. }
  9. location = /1.jpg {
  10. root /data/nginx/images;
  11. index index.html;
  12. }
  13. }
  14. [root@CentOS7 ~]#mkdir /data/nginx/images
  15. [root@CentOS7 ~]#rz -E
  16. rz waiting to receive.
  17. [root@CentOS7 ~]#mv 1.jpg /data/nginx/images/ # 上传1.jpg到/data/nginx/images
  18. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -t
  19. nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
  20. nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
  21. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload # 重启nginx

访问测试

location 区分大小写

  1. [root@CentOS7 ~]#mv /data/nginx/images/1.jpg /data/nginx/images/Darius.jpg
  2. [root@CentOS7 ~]#vim /apps/nginx/conf.d/pc.conf
  3. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  4. server {
  5. listen 80;
  6. server_name www.darius.com;
  7. location / {
  8. root /data/nginx/html/pc;
  9. }
  10. location ~ /D.*\.jpg {
  11. root /data/nginx/images;
  12. index index.html;
  13. }
  14. }
  15. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

测试页

location 不区分大小写

  对用户请求的uri做模糊匹配,也就是uri中无论都是大写、都是小写或者大小写混合,此模式也都会匹配,通常使用此模式匹配用户request中的静态资源并继续做下一步操作。

  1. [root@CentOS7 ~]#vim /apps/nginx/conf.d/pc.conf
  2. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  3. server {
  4. listen 80;
  5. server_name www.darius.com;
  6. location / {
  7. root /data/nginx/html/pc;
  8. }
  9. location ~* /D.*\.jpg {
  10. root /data/nginx/images;
  11. index index.html;
  12. }
  13. }
  14. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload
注:不区分大小写是对该目录文件中的规则不区分大小写,不是对此文件名称不区分大小写,在Linux中是严格区分文件大小写的。

location 文件名后缀

  1. #上传一个和images目录不一样内容的的图片1.j到/data/nginx/images1
  2. location ~* \.(gif|jpg|jpeg|bmp|png|tiff|tif|ico|wmf|js)$ {
  3. root /data/nginx/images1;
  4. index index.html;
  5. }
  6. 重启Nginx并访问测试

URI规则定义

  1. [root@CentOS7-2 ~]#echo "images" >/data/nginx/images123/index.html
  2. [root@CentOS7-2 ~]#cat /apps/nginx/conf.d/pc.conf
  3. server {
  4. listen 80;
  5. server_name www.darius.com;
  6. error_log logs/www_darius_com_error.log;
  7. access_log logs/www_darius_com_access.log;
  8. location ^~ /images {
  9. root /data/nginx;
  10. index index.html;
  11. }
  12. }
  13. [root@CentOS7-2 ~]#nginx -s stop
  14. [root@CentOS7-2 ~]#nginx
  15. 访问测试(以images开头的文件,匹配location规则)
  16. [root@CentOS7-2 ~]#curl -L www.darius.com/images123
  17. images

匹配案例的优先级

  1. 匹配优先级:=, ^~, ~/~*,/
  2. location优先级:(location =) > (location 完整路径) > (location ^~ 路径) > (location ~,~* 正则顺序) > (location 部分起始路径) > (/)
  3. 注:
  4. 完整路径就是 /static 这样的完整的URL
  5. 部分就是 使用location ^~ /static 定义了开始,但是后面还有可能是 /statici-mage

生产中使用的案例

  1. 直接匹配网站根会加速Nginx访问处理:
  2. location = / {
  3. ......;
  4. } l
  5. ocation / {
  6. ......;
  7. }
  8. 态资源配置:
  9. location ^~ /static/ {
  10. ......;
  11. } #
  12. 或者
  13. location ~* \.(gif|jpg|jpeg|png|css|js|ico)$ {
  14. ......;
  15. }
  16. 应用配置
  17. location ~* /app1 {
  18. ......;
  19. } l
  20. ocation ~* /app2 {
  21. ......;
  22. }

Nginx 四层访问控制

  访问控制基于模块ngx_http_access_module实现,可以通过匹配客户端源IP地址进行限制。

  1. server {
  2. listen 80;
  3. server_name www.darius.com;
  4. error_log logs/www_darius_com.log;
  5. location / {
  6. alias /data/nginx/html/pc;
  7. index index.html;
  8. deny 192.168.36.110;
  9. allow 192.168.36.0/24;
  10. deny all; #先允许小部分,再拒绝大部分
  11. }
  12. }
  13. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

测试

  1. [root@CentOS-Test ~]#curl www.darius.com # 拒绝192.168.36.110主机
  2. <html>
  3. <head><title>403 Forbidden</title></head>
  4. <body bgcolor="white">
  5. <center><h1>403 Forbidden</h1></center>
  6. <hr><center>nginx/1.14.2</center>
  7. </body>
  8. </html>
  9. [root@CentOS7 ~]#curl www.darius.com # 允许192.168.36.0/24网段主机
  10. pc web

Nginx账户认证功能

  1. [root@CentOS7 ~]#yum install -y httpd-tools -y
  2. [root@CentOS7 ~]#htpasswd -cbm /apps/nginx/conf.d/.htpasswd user1 123456 # 生成认证用户
  3. Adding password for user user1
  4. [root@CentOS7 ~]#htpasswd -bm /apps/nginx/conf.d/.htpasswd user2 123456
  5. Adding password for user user2
  6. [root@CentOS7 ~]#tail /apps/nginx/conf.d/.htpasswd
  7. user1:$apr1$CsaWdjbv$EwlG9UR6hEg/RYKhP0HS/1
  8. user2:$apr1$5/nkjgHY$Sj.vqTB6M4wqapmm.jTu3.

修改配置文件

  1. [root@CentOS7 ~]#vim /apps/nginx/conf.d/pc.conf
  2. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  3. server {
  4. listen 80;
  5. server_name www.darius.com;
  6. error_log logs/www_darius_com.log;
  7. location / {
  8. root /data/nginx/html/pc;
  9. index index.html;
  10. auth_basic "login password";
  11. auth_basic_user_file /apps/nginx/conf.d/.htpasswd;
  12. }
  13. }
  14. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload # 重启nginx服务

测试

自定义错误页面

  1. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  2. server {
  3. listen 80;
  4. server_name www.darius.com;
  5. error_page 500 502 503 504 404 /error.html; # 默认目录下创建error.html页面
  6. error_log logs/www_darius_com_error.log; # 错误日志
  7. access_log logs/www_darius_com_access.log; # 访问日志
  8. location = /error.html {
  9. root html;
  10. }
  11. location / {
  12. root /data/nginx/html/pc;
  13. index index.html;
  14. }
  15. }
  16. [root@CentOS7 ~]#echo "ERROR" >/apps/nginx/html/error.html # 创建error页面
  17. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -t
  18. nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
  19. nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
  20. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

测试

  1. [root@CentOS-Test ~]#curl www.darius.com
  2. pc web
  3. [root@CentOS-Test ~]#curl www.darius.com/aa # 访问不存在的页面,显示定义的错误页面
  4. ERROR

检测文件是否存在

  try_files会按顺序检查文件是否存在,返回第一个找到的文件或文件夹(结尾加斜线表示为文件夹),如果所有文件或文件夹都找不到,会进行一个内部重定向到最后一个参数。只有最后一个参数可以引起一个内部重定向,之前的参数只设置内部URI的指向。最后一个参数是回退URI且必须存在,否则会出现内部500错误。

  1. [root@CentOS7 ~]#vim /apps/nginx/conf.d/pc.conf
  2. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  3. server {
  4. listen 80;
  5. server_name www.darius.com;
  6. error_log logs/www_darius_com_error.log;
  7. access_log logs/www_darius_com_access.log;
  8. location / {
  9. root /data/nginx/html/pc;
  10. index index.html;
  11. try_files $uri $uri/index.html $uri.html =489; # 重启nginx,当访问http://www.darius.com/about/xx.html等不存在的uri显示返回数据的状态码
  12. }
  13. }
  14. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

访问测试

  1. [root@CentOS-Test ~]#curl --head www.darius.com/about/xx.html
  2. HTTP/1.1 489 # 489就是自定义的状态返回码
  3. Server: nginx/1.14.2
  4. Date: Thu, 30 May 2019 07:56:54 GMT
  5. Content-Length: 0
  6. Connection: keep-alive

当访问的uri不存在时返回default

  1. [root@CentOS7 ~]#cat /apps/nginx/conf.d/pc.conf
  2. server {
  3. listen 80;
  4. server_name www.darius.com;
  5. error_log logs/www_darius_com_error.log;
  6. access_log logs/www_darius_com_access.log;
  7. location / {
  8. root /data/nginx/html/pc;
  9. index index.html;
  10. try_files $uri $uri/index.html $uri.html /about/default.html; # 重启nginx并测试,当访问到http://www.darius.com/about/xx.html等不存在的uri会显示default
  11. }
  12. }
  13. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload
  14. [root@CentOS7 ~]#echo "default" >> /data/nginx/html/pc/about/default.html

访问测试

  1. [root@CentOS-Test ~]#curl www.darius.com/about/xx.html
  2. default

长连接配置

  keepalive_timeout number; #设定保持连接超时时长,0表示禁止长连接,默认为75s,通常配置在http字段作为站点全局配置 keepalive_requests number; #在一次长连接上所允许请求的资源的最大数量,默认为100次

  1. keepalive_requests 3;
  2. keepalive_timeout 65 60;
  3. 开启长连接后,返回客户端的会话保持时间为60s,单次长连接累计请求达到指定次数请求或65秒就会被断开,后面的60为发送给客户端应答报文头部中显示的超时时间设置为60s:如不设置客户端将不显示超时时间。
  4. Keep-Alive:timeout=60 #浏览器收到的服务器返回的报文
  5. 如果设置为0表示关闭会话保持功能,将如下显示:
  6. Connection:close #浏览器收到的服务器返回的报文

Nginx作为下载服务器配置

  1. location /download {
  2. autoindex on; # 自动索引功能
  3. autoindex_exact_size on; # 计算文件确切大小(单位bytes),off只显示大概大小(单位kb、mb、gb)
  4. autoindex_localtime on; # 显示本机时间而非GMT(格林威治)时间
  5. limit_rate 10k; # 限制响应给客户端的传输速率,单位是bytes/second,默认值0表示无限制限速与不限速的对比
  6. root /data/nginx/html/pc;
  7. }
  8. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -t
  9. nginx: the configuration file /apps/nginx/conf/nginx.conf syntax is ok
  10. nginx: configuration file /apps/nginx/conf/nginx.conf test is successful
  11. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload

创建测试页面进行测试

  1. 将光盘镜像挂载到此目录下进行测试
  2. [root@CentOS7 ~]#mount /dev/sr0 /data/nginx/html/pc/download/
  3. mount: /dev/sr0 写保护,将以只读方式挂载
  4. [root@CentOS7 ~]#ll /data/nginx/html/pc/download/
  5. 总用量 1656
  6. -rw-rw-r-- 1 root root 14 11 26 2018 CentOS_BuildTag
  7. drwxr-xr-x 3 root root 2048 11 26 2018 EFI
  8. -rw-rw-r-- 1 root root 227 8 30 2017 EULA
  9. -rw-rw-r-- 1 root root 18009 12 10 2015 GPL
  10. drwxr-xr-x 3 root root 2048 11 26 2018 images
  11. drwxr-xr-x 2 root root 2048 11 26 2018 isolinux
  12. drwxr-xr-x 2 root root 2048 11 26 2018 LiveOS
  13. drwxrwxr-x 2 root root 1656832 11 25 2018 Packages
  14. drwxrwxr-x 2 root root 4096 11 26 2018 repodata
  15. -rw-rw-r-- 1 root root 1690 12 10 2015 RPM-GPG-KEY-CentOS-7
  16. -rw-rw-r-- 1 root root 1690 12 10 2015 RPM-GPG-KEY-CentOS-Testing-7
  17. -r--r--r-- 1 root root 2883 11 26 2018 TRANS.TBL

测试页

Nginx作为上传服务器

  1. client_max_body_size 1m #设置允许客户端上传单个文件的最大值,默认值为1m
  2. client_body_buffer_size size; #用于接收每个客户端请求报文的body部分的缓冲区大小;默认16k;
  3. 超出此大小时,其将被暂存到磁盘上的由下面client_body_temp_path指令所定义的位置
  4. client_body_temp_path path [level1 [level2 [level3]]];
  5. #设定存储客户端请求报文的body部分的临时存储路径及子目录结构和数量,目录名为16进制的数字,使用hash
  6. 之后的值从后往前截取1位、2位、2位作为文件名:
  7. [root@s3 ~]# md5sum /data/nginx/html/pc/index.html
  8. 95f6f65f498c74938064851b1bb 96 3d 4 /data/nginx/html/pc/index.html
  9. 1级目录占116进制,即2^4=16个目录 0-f
  10. 2级目录占216进制,即2^8=256个目录 00-ff
  11. 3级目录占216进制,即2^8=256个目录 00-ff
  12. 配置示例:
  13. client_max_body_size 10m
  14. client_body_buffer_size 16k;
  15. client_body_temp_path /apps/nginx/temp 1 2 2; #reload Nginx会自动创建temp目录

其他配置

  1. keepalive_disable none | browser ...; # 对哪种浏览器禁用长连接
  2. limit_except method ... { ... } # 限制客户端使用除了指定的请求方法之外的其它方法,仅用于location
  3. method:GET, HEAD, POST, PUT, DELETEMKCOL, COPY, MOVE, OPTIONS, PROPFIND,PROPPATCH, LOCK, UNLOCK, PATCH
  4. 示例:
  5. location /upload {
  6. root /data/magedu/pc;
  7. index index.html;
  8. limit_except GET { # 除了GET之外的其他请求方法,仅允许192.168.36.110主机使用
  9. allow 192.168.36.110;
  10. deny all;
  11. }
  12. }
  1. aio on | off #是否启用asynchronous file I/O(AIO)功能,需要编译开启
  2. linux 2.6以上内核提供以下几个系统调用来支持aio
  3. 1SYS_io_setup:建立aio context
  4. 2SYS_io_submit: 提交I/O操作请求
  5. 3SYS_io_getevents:获取已完成的I/O事件
  6. 4SYS_io_cancel:取消I/O操作请求
  7. 5SYS_io_destroy:毁销aiocontext
  1. directio size | off; #操作完全和aio相反,aio是读取文件而directio是写文件到磁盘,启用直接I/O,默认为关闭,当文件大于等于给定大小时,例如directio 4m,同步(直接)写磁盘,而非写缓存。
  1. open_file_cache off; #是否缓存打开过的文件信息
  2. open_file_cache max=N [inactive=time];
  3. nginx可以缓存以下三种信息:
  4. (1) 文件元数据:文件的描述符、文件大小和最近一次的修改时间
  5. (2) 打开的目录结构
  6. (3) 没有找到的或者没有权限访问的文件的相关信息
  7. max=N:可缓存的缓存项上限数量;达到上限后会使用LRU(Least recently used,最近最少使用)算法实现管理
  8. inactive=time:缓存项的非活动时长,在此处指定的时长内未被命中的或命中的次数少于
  9. open_file_cache_min_uses指令所指定的次数的缓存项即为非活动项,将被删除
  1. open_file_cache_errors on | off;
  2. 是否缓存查找时发生错误的文件一类的信息
  3. 默认值为off
  1. open_file_cache_min_uses number;
  2. open_file_cache指令的inactive参数指定的时长内,至少被命中此处指定的次数方可被归类为活动项
  3. 默认值为1
  1. open_file_cache_valid time;
  2. 缓存项有效性的检查验证频率,默认值为60s
  3. open_file_cache max=10000 inactive=60s; # 最大缓存10000个文件,非活动数据超时时长60s
  4. open_file_cache_valid 60s; # 每间隔60s检查一下缓存数据有效性
  5. open_file_cache_min_uses 5; # 60秒内至少被命中访问5次才被标记为活动数据
  6. open_file_cache_errors on; # 缓存错误信息
  1. server_tokens off; # 隐藏Nginx server版本
  2. [root@CentOS7 ~]#grep "server_tokens" /apps/nginx/conf/nginx.conf
  3. server_tokens off;
  4. [root@CentOS7 ~]#/apps/nginx/sbin/nginx -s reload
  5. 访问测试
  6. [root@CentOS-Test ~]#curl --head www.darius.com
  7. HTTP/1.1 200 OK
  8. Server: nginx # 版本号已隐藏
  9. Date: Thu, 30 May 2019 08:27:49 GMT
  10. Content-Type: text/html
  11. Content-Length: 7
  12. Last-Modified: Thu, 30 May 2019 03:06:03 GMT
  13. Connection: keep-alive
  14. ETag: "5cef489b-7"
  15. Accept-Ranges: bytes

Nginx location相关配置说明的更多相关文章

  1. nginx location配置说明

    nginx location语法规则:location  [=|~|~*|^~]  /uri/  { … } nginx的location匹配的变量是$uri 规则优先级 = 高于 ^~ 高于 ~* ...

  2. Nginx location 匹配顺序整理

    Nginx location模块整理 具体的Nginx安装就不在这里描述了,这里只是为了对location的描述 Nginx环境 a. 查看当前系统cat /etc/redhat-release [r ...

  3. Nginx http相关常用配置总结

    Nginx http相关常用配置总结   by:授客  QQ:1033553122   测试环境 nginx-1.10.0 client_max_body_size Syntax: client_ma ...

  4. Nginx Location指令配置及常用全局变量

    ./configure的含义 在实践安装nginx的时候,不知道./configure是什么意思,这里特地记录一下. 在linux中./代表当前目录,属于相对路径../代表上一级目录,属于相对路径/代 ...

  5. Nginx location模块整理

    location模块 Nginx location location 指令的作用是根据用户请求的URI来执行不同的应用,URI就是根据用户请求到的网址URL进行匹配,匹配成功了进行相关的操作. loc ...

  6. Nginx Rewrite相关功能

    目录 Nginx Rewrite相关功能 ngx_http_rewrite_module模块指令: if指令: set指令: break指令: return指令: rewrite_log指令: rew ...

  7. nginx location 知识知多少

    写在之前 众所周知 nginx location 路由转发规则多种多样,尤其是 [ = | ~ | ~* | ^~ ] 这些前缀是什么意思.root 与 alias 是否可以区分开,nginx 作为反 ...

  8. Nginx Location配置总结

    Nginx Location配置总结 语法规则: location [=|~|~*|^~] /uri/ { - }= 开头表示精确匹配^~ 开头表示uri以某个常规字符串开头,理解为匹配 url路径即 ...

  9. nginx location配置

    nginx location配置   location在nginx中起着重要作用,对nginx接收到的请求字符串进行处理,如地址定向.数据缓存.应答控制.代理转发等location语法location ...

随机推荐

  1. Linux删除文件后磁盘目录不释放

    今天测试oracle数据库的时候,把表空间连带内容和数据文件一并删除了,但是删除之后,查看数据文件不存在了,但是目录的带下没有释放 SQL> drop tablespace users incl ...

  2. Windows安全加固

    Windows安全加固 # 账户管理和认证授权 # 1.1 账户 # 默认账户安全 # 禁用Guest账户. 禁用或删除其他无用账户(建议先禁用账户三个月,待确认没有问题后删除.) 操作步骤 本地用户 ...

  3. 定制个性化的GUI

    你现在还在使用SAP GUI710或者是GUI720,又或者更早的640等吗?那么古董先生,推荐您使用GUI730吧,您可能会730好在哪?那我建议您去百度或者Google问吧.对于新的GUI730, ...

  4. ObjectMapper将josn字符串转化为List

    一.利用ObjectMapper将json字符串转为List Student.java package objectmapper; import java.io.Serializable; publi ...

  5. mysql 设置外键约束时如何删除数据

    Mysql中如果表和表之间建立的外键约束,则无法删除表及修改表结构 解决方法是在Mysql中取消外键约束: SET FOREIGN_KEY_CHECKS=0; 然后将原来表的数据导出到sql语句,重新 ...

  6. javascript之Banner图片焦点轮播

    这个Banner唯一不好的就是没有前进和后退的button,写过两个版本的banner,这次这个是下面有浮动层的. <!DOCTYPE html><html xmlns=" ...

  7. 洛谷P2687 & P1108

    一道求最长下降子序列和与最长下降子序列长度相同的方案数的DP 题意: 一串数字,找出最长下降子序列,记录他的长度 \(length\) 并输出 然后找出所有长度达到 \(length\) 的下降子序列 ...

  8. Python 中 sorted 如何自定义比较逻辑

    在 Python 中对一个可迭代对象进行排序是很常见的一个操作,一般会用到 sorted() 函数 num_list = [4, 2, 8, -9, 1, -3] sorted_num_list = ...

  9. HTTPS是怎么保证数据安全传输的?

    前言 关于HTTPS的连接过程,也是老生常谈的话题了. 其中涉及到的数字证书.电子签名.SSL/TLS.对称加密.非对称加密的问题总是让人摸不清头脑,不知道怎么回答. 今天就和大家再熟悉熟悉这其中千丝 ...

  10. Windows操作Redis及Redis命令

    Windows操作Redis及Redis命令 一.Windows下操作Redis 设置密码 打开redis服务 Windows 下的redis命令行 二.redis常用命令大全 key String ...