Hi 你好,欢迎访问!登录
当前位置:首页 - 运维笔记 - 正文 君子好学,自强不息!

Nginx 代理Alist规则

2025-01-04运维笔记打野哥730°c
A+ A-
#PROXY-START/

location ^~ /
{
    proxy_pass http://127.0.0.1:5244/d/;
    proxy_set_header Host 127.0.0.1;
    proxy_set_header AA "some_value";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header REMOTE-HOST $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
    proxy_http_version 1.1;
    # proxy_hide_header Upgrade;

    #more_set_headers 'Content-Type: image/jpeg';
    #add_header Content-Disposition "attachment";
    #add_header Content-Type "image/jpeg";
    #add_header 'Content-Type: image/jpeg';
    #add_header X-Cache $upstream_cache_status;
    #Set Nginx Cache

    set $static_file5O8ITIuJ 0;
    
    if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
    {
        set $static_file5O8ITIuJ 1;
        expires 1m;
    }
    if ( $static_file5O8ITIuJ = 0 )
    {
        add_header Cache-Control no-cache;
    }
    if ( $uri )
    {
      # 更改所有请求返回图片... 
      add_header Content-Disposition "attachment";
      add_header Content-Type "image/jpeg";
    }
    if ( $uri ~* "\.(mp3||flac)$" )
    {
      add_header Content-Disposition "inline";
      add_header Content-Type "audio/mpeg";
    }
    if ( $uri ~* "\.(mp4||mkv)$" )
    {
      add_header Content-Disposition "inline";
      add_header Content-Type "video/mp4";
    }
    
    location = / {
        deny all; # 拒绝访问首页
    }
}
#PROXY-END/


  选择打赏方式
微信赞助

打赏

QQ钱包

打赏

支付宝赞助

打赏

未定义标签

发表评论

取消回复

选填

必填

必填

选填

请拖动滑块解锁
>>


赖皮狗子
时间:2025-02-04 23:13:16

15454454

打野哥
时间:2025-02-10 13:49:15

@赖皮狗子:?????

  用户登录