• mac nginx 虚拟机配置


    myb.local.conf

    `server {
    listen 80 default_server;
    root /Users/x/web/m_api/Public;

    client_max_body_size 50m;
    location /h5/ {
        charset  utf-8;
        index index.html;
        root /Users/x/web/m_api/Public;
        try_files $uri $uri/ /h5/index.html?$query_string;
    }
    location /a/ {
        charset  utf-8;
        index index.html;
        root /Users/x/web/m_api/Public;
        try_files $uri $uri/ /a/index.html?$query_string;
    }
    
    location / {
        root /Users/x/web/m_api/Public;
        #允许跨域
        add_header 'Access-Control-Allow-Origin' $http_origin;
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 't-host,t-token,t-client';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
        if ($request_method = 'OPTIONS') {
                add_header 'Access-Control-Allow-Origin' $http_origin;
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 't-host,t-token,t-client';
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
    
                return 204;
        }
        proxy_http_version 1.1;
        proxy_set_header Connection "keep-alive";
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host      $host;
        if (!-f $request_filename) {
             proxy_pass http://127.0.0.1:9501;
        }
    }
    

    }`

  • 相关阅读:
    修改linux命令行提示符颜色
    passwd命令
    用户与用户组
    计划任务
    sed简单用法
    sed命令实现对文件内容的添加
    C#颜色选择器的调用操作
    插入排序算法的学习
    二叉树的学习记录
    判断两个单链表是否相交及相交的第一个节点
  • 原文地址:https://www.cnblogs.com/xielisen/p/13752489.html
Copyright © 2020-2023  润新知