mac 安装:
    brew install nginx

    open /usr/local/etc/nginx config 更改:

    1. server {
    2. listen 80;
    3. server_name nexus.shiqi.cn;
    4. location / {
    5. # 允许请求地址跨域 * 做为通配符
    6. add_header 'Access-Control-Allow-Origin' '*';
    7. # 设置请求方法跨域
    8. add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
    9. # 设置是否允许 cookie 传输
    10. add_header 'Access-Control-Allow-Credentials' 'true';
    11. # 设置请求头 这里为什么不设置通配符 * 因为不支持
    12. 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';
    13. # 设置 options 请求处理
    14. if ( $request_method = 'OPTIONS' ) {
    15. return 200;
    16. }
    17. # 路由配置
    18. proxy_pass http://192.168.1.101:8081/;
    19. }
    20. }
    21. server {
    22. listen 80;
    23. server_name jenkins.shiqi.cn;
    24. location / {
    25. # 路由配置
    26. proxy_pass http://192.168.1.101:8888;
    27. }
    28. }