mac 安装:
brew install nginx
open /usr/local/etc/nginx config 更改:
server {listen 80;server_name nexus.shiqi.cn;location / {# 允许请求地址跨域 * 做为通配符add_header 'Access-Control-Allow-Origin' '*';# 设置请求方法跨域add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';# 设置是否允许 cookie 传输add_header 'Access-Control-Allow-Credentials' 'true';# 设置请求头 这里为什么不设置通配符 * 因为不支持add_header 'Access-Control-Allow-Headers' 'Authorization,Content-Type,Accept,Origin,User-Agent,DNT,Cache-Control,X-Mx-ReqToken,X-Data-Type,X-Requested-With,X-Data-Type,X-Auth-Token';# 设置 options 请求处理if ( $request_method = 'OPTIONS' ) {return 200;}# 路由配置proxy_pass http://192.168.1.101:8081/;}}server {listen 80;server_name jenkins.shiqi.cn;location / {# 路由配置proxy_pass http://192.168.1.101:8888;}}
