Skip to content

Instantly share code, notes, and snippets.

@hecheng337
Last active August 18, 2025 12:53
Show Gist options
  • Save hecheng337/03b95be657edbac5824591a951b2075a to your computer and use it in GitHub Desktop.
Save hecheng337/03b95be657edbac5824591a951b2075a to your computer and use it in GitHub Desktop.
反向代理 MisakaF 公费服 (Nginx)

如果你之前已经设置好了反向代理服务器:

1.将原来的 location / {} 复制一份,粘贴到下面;
2.在原来的 location 块中加入一行:
proxy_redirect https://MisakaF视频推流地址/ https://你服务器的地址/;
3.在复制的 location 块中,将 location / 改成 location /p/,将 proxy_pass 的目标地址改成 视频推流地址 /p/

完整的 Nginx 配置示范:

map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
    }

server {
    listen 443 ssl http2;
    server_name 你服务器的地址;

    ###
    你的 SSL 相关配置
    ###

    client_max_body_size 20M;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    location / {
        proxy_pass https://MisakaF服务器地址;
        proxy_redirect https://MisakaF视频推流地址/ https://你服务器的地址/;

        proxy_set_header Referer "https://MisakaF服务器地址/web/index.html";
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        proxy_set_header Host $proxy_host;
        proxy_ssl_server_name on;
        proxy_http_version 1.1;
    }

    location /p/ {
        proxy_pass https://MisakaF视频推流地址/p/;
        proxy_set_header Referer "https://MisakaF服务器地址/web/index.html";
        proxy_set_header Host $proxy_host;
        proxy_ssl_server_name on;
        proxy_buffering off;
    }
}

P.s. 只对你填写的推流线路有效

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment