Skip to main content

Reverse proxy

Andy HsuGuideInstallGuideAbout 1 min

Reverse proxy

The program listens to port 5244 by default. If you do reverse proxy, recommended you set site_url so that alist can works fine.

If you want to use a sub folder, refer to reverse proxy with sub folder

Missing https or port / Can't Play video when reverse-proxy non-standard ports or enable https?

You need to passed correct host header, refer to #726open in new window #1159open in new window #2429open in new window #3644open in new window #4181open in new window #4719open in new window

nginx

Add in the server field of the website configuration file

location / {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Range $http_range;
	  proxy_set_header If-Range $http_if_range;
    proxy_redirect off;
    proxy_pass http://127.0.0.1:5244;
    # the max size of file to upload
    client_max_body_size 20000m;
}

Note

If you use the bt.cnopen in new window, be sure to delete the following default configuration

  • location ~ ^/(.user.ini|.htaccess|.git|.svn|.project|LICENSE|README.md
  • location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
  • location ~ .*.(js|css)?$

Apache

Add the anti-generation configuration item ProxyPass under the VirtualHost field, such as:

<VirtualHost *:80>
    ServerName myapp.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /www/myapp/public

    AllowEncodedSlashes NoDecode
    ProxyPass "/" "http://127.0.0.1:5244/" nocanon
</VirtualHost>

Caddy

Add the reverse_proxy configuration item reverse_proxy under the Caddyfile file, for example:

:80 {
     reverse_proxy 127.0.0.1:5244
}

Demonstration of Setting up Reverse Proxy in BT Panel

1.Login to the BT panel and add a new website.

bt_new_website

2.Modify the website settings.

bt_new_website_01

3.Remove the default panel code.

bt_delete_default_config_01

bt_delete_default_config_02

4.Add the reverse proxy.

bt_reverse_proxy

If you need to apply for an SSL certificate, you can first apply for the certificate in the SSL option, and then set up the reverse proxy. Alternatively, you can set up the reverse proxy first, disable the proxy function, apply for an SSL certificate, and then enable the proxy again.