M

MALA文档

MALA文档

  • 首页
  • 关于
Home 宝塔新建反向代理站点
文章

宝塔新建反向代理站点

Posted 2024-08-28 Updated 2024-08- 28
By mala
8~10 min read

此篇文档为基础性补充文档,如果你会使用则无需阅读

首先打开宝塔新建静态网站

  1. 由于宝塔不支持第一个域名添加泛域名,所以添加两个域名
    aaa.com
    *.aaa.com

  2. PHP版本选择:纯静态

签发SSL证书

  1. 点击 SSL

  2. 选择DNS验证

  3. 域名全选

  4. 点击申请证书,然后根据提示进行添加DNS解析,申请证书

添加反向代理

  1. 点击反向代理

  2. 点击添加反向代理

  3. 在目标URL填写你原本的v2b站点地址

  4. 点击确定

允许跨域

  1. 点击配置文件

  2. 按图添加允许跨域的代码然后保存

# 允许所有域进行跨域请求
    add_header 'Access-Control-Allow-Origin' '*';
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
    add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

    # 预检请求
    if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, DELETE, PUT';
        add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
        add_header 'Access-Control-Max-Age' 1728000;
        add_header 'Content-Type' 'text/plain; charset=utf-8';
        add_header 'Content-Length' 0;
        return 204;
    }

至此配置完毕。

License:  私有
Share

Further Reading

OLDER

MALA主题高级版安装教程-基础版

NEWER

获取和安装分离主题文件

Recently Updated

  • V2B还原过期用户数据
  • Epusdt支付插件
  • Mala-Pro主题对接Crisp
  • MALA-Pro 主题前端安装文档
  • MALA-Pro 主题API后端安装文档

Trending Tags

Halo

Contents

©2025 MALA文档. Some rights reserved.

Using the Halo theme Chirpy