前端必会的nginx知识点
1. 启动?停止?reload配置 nginx -s reload # 热重启 nginx -s reopen # 重启Nginx nginx -s stop # 快速关闭 nginx -s quit # 等待工作进程处理完成后关闭 nginx -T # 查看配置文件的实际内容 2. nginx如何做反向http代理 location ^~ /api { proxy_pass http://192.168.40.174:32020; } 3. nginx要如何配置才能处理跨域问题 location ^~ /p/asm { proxy_pass http://192.168.40.174:32020; add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,PATCH,OPTIONS'; add_header 'Access-Control-Allow-Headers' 'Content-Type,ssid'; if ($request_method = 'OPTIONS') {return 204;} proxy_redirect off; proxy_set_header Host $host; } 4. 如何拦截某个请求,直接返回某个状态码? location ^~ /p/asm { return 204 "OK"; } 5....