Loading

Nginx跨域配置、限制连接、限制下载速度

目录

一、Nginx跨域配置

二、Nginx限制连接配置

三、Nginx限制下载速度配置


一、Nginx跨域配置

#允许跨域请求的域,* 代表所有
add_header 'Access-Control-Allow-Origin' *;
#允许请求的header
add_header 'Access-Control-Allow-Headers' *;
#允许带上cookie请求
add_header 'Access-Control-Allow-Credentials' 'true';
#允许请求的方法,比如 GET,POST,PUT,DELETE
add_header 'Access-Control-Allow-Methods' *;

二、Nginx限制连接配置

 location / {
    root   /opt/www/wwwroot;
    index  index.php index.html index.htm;
    limit_conn addr 5; #限制每个IP只能发起5个连接
}

三、Nginx限制下载速度配置

location /download { 
       limit_rate_after 5m; 
       limit_rate 128k; 
 }


 

posted @ 2022-04-03 10:00  Roc-xb  阅读(93)  评论(0)    收藏  举报

易微帮源码


易微帮官网