天天看點

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; 
 }      
上一篇: nvidia面試題
下一篇: jsp面試題

繼續閱讀