> 文档中心 > Nginx跨域配置、限制连接、限制下载速度

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

目录

一、Nginx跨域配置

二、Nginx限制连接配置

三、Nginx限制下载速度配置


一、Nginx跨域配置

#允许跨域请求的域,* 代表所有add_header 'Access-Control-Allow-Origin' *;#允许请求的headeradd_header 'Access-Control-Allow-Headers' *;#允许带上cookie请求add_header 'Access-Control-Allow-Credentials' 'true';#允许请求的方法,比如 GET,POST,PUT,DELETEadd_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;  }

 

NICE