nginx 解决前端项目的跨域问题
server {
listen 8090;
server_name http://192.168.0.167;
location / {
add_header Access-Control-Allow-Origin '*' always;
proxy_set_header origin 'http://192.168.0.233:8085';
add_header Access-Control-Allow-Headers '*';
add_header Access-Control-Allow-Methods '*';
add_header Access-Control-Allow-Credentials 'true';
if ($request_method = 'OPTIONS') {
return 204;
}
proxy_pass http://192.168.0.233:8085/;
}
}
nginx 映射磁盘目录(windows)
server {
listen 9701;
server_name localhost;
location / {
root D:/HFCC_WEB/mapImg;
autoindex on;
}
}