Alist Series

Alist丨See first and then use six types of installation methods to choose from [001]
Alist丨VPS installation tutorial: Set up privacy and security first and then talk about external network login, it is very convenient [002]

After installing Alist in the VPS, we can log in from the external network very conveniently. Whether it is to convert the network disk into a local disk through WebDav, or to build the VPS into a small network disk, Alist has more usage scenarios.

However, logging in directly through the IP:port method has many inconveniences and security risks: first, the address is complex and difficult to remember, and second, it will directly expose the server IP and make it easy to be attacked. Therefore, if you have a domain name, you can solve these problems well.

Assumptions--

  • The IP address is: 1.1.1.1
  • The port number is alist default: 5244
  • Primary domain: playful.com
  • Second level domain: alist.playful.com

I will provide several methods and you can choose according to your needs.

1. The simplest setting: domain name: port number

If you don't want to set up a reverse proxy on your vps and just want to log in to alist relatively easily, then this method is the most suitable and easy to operate.

  • Bind the primary domain name on Cloudflare
  • In DNS resolution, set the secondary domain name alist and bind IP [1.1.1.1]
  • Do not check CF reverse generation (orange)
  • save
三种alist绑定域名办法

At this time, you can use [http://alist.playful.com:5244】Log in with this address.

2. The easiest operation: change port to 80

For security reasons, it is recommended that you change the default port number 5244 when installing alist. One way is to directly change the port number to 80. Because port 80 is the default open port of most servers, used for hosting websites, web services, etc., and supports the http communication protocol.

For detailed operation methods, please refer to Issue 2:

《Alist丨VPS installation tutorial: Set up privacy and security first and then log in to the external network, it is very convenient》

After doing this, repeat the first part of the domain name binding process, and you can directly use [http://alist.playful.com】Log in.

However, there are hidden dangers in doing so. Because most web services use port 80, if your vps is used for other purposes, it is easy to cause port conflicts. Therefore, it is not recommended to do so.

Code to view vps port usage:

sudo netstat -tulpn | grep ":80"

3. Once and for all: Nginx port forwarding (reverse generation)

In short, it is to install Nginx on the vps, and directly forward the traffic coming from port 80 that wants to access alist to port 5244, so as to achieve the application of accessing multiple ports from port 80. The specific operations are as follows:

1. Install Nginx

upgrade

sudo apt update

Install

sudo apt install nginx

Confirmation Status

sudo systemctl status nginx

If it fails, it is usually because port 80 is occupied by other applications.

Check it like this:

sudo netstat -tulpn | grep ":80"

Close the app

sudo kill process_id

After the settings are complete, restart Nginx

sudo systemctl restart nginx

三种alist绑定域名办法

The reason why I know that there are installation failures is because I changed the alist port to 80. So, I have gone through all these detours.

2. Set up port forwarding

In the video tutorial, my alist port number has been changed to 12345, and I will no longer demonstrate with the default 5244. Just remember to change your own port number.

(1) Create Nginx configuration file

First, still use finalshell to connect to the vps, and then create a new configuration file for the Alist reverse proxy. For example, you can create a file named alist-proxy.conf in the /etc/nginx/sites-available directory.

(2) Configure Nginx

Add the following configuration to the alist-proxy.conf file [note to change the domain name and 12345 port]:

server {

    listen 80; # listens on port 80 (or your desired public port)

    server_name yourdomain.com; # is replaced with the actual alist domain name

    location / {

        proxy_pass http://localhost:12345; # proxies the request to Alist on port 12345

        proxy_set_header Host $host;

        proxy_set_header X-Real-IP $remote_addr;

        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_set_header X-Forwarded-Proto $ scheme;

    }

}

(3) Test configuration

Check the Nginx configuration for syntax errors:

sudo nginx -t

(4) Enable configuration

Create a symbolic link from the configuration file to the /etc/nginx/sites-enabled directory to enable it

sudo ln -s /etc/nginx/sites-available/alist-proxy.conf /etc/nginx/sites-enabled/alist-proxy.conf

(5) Restart Nginx

sudo systemctl restart nginx

If everything goes well, when you have done domain name resolution in Cloudflare, you can directly use [http://alist.playful.com】Log in to alist. This operation can enable CF reverse generation [orange check].

Okay, if you find it useful, just follow it.

If you encounter any errors during the installation process, please do not leave me a message. Because I do not understand the code, I just throw it into Gemini and ChatGPT and let AI provide solutions.

Next time, let’s talk about alist offline download settings.


By Loogn sir

An ordinary person who likes to use fun to resist mediocrity; often writes about his own interests; so you will see technology, digital, entertainment, credit cards, Internet... Refuse to be high-sounding and don't be a pseudo-expert; make professional life-like and biochemistry interesting; well, that's it~

Leave a Reply

Your email address will not be published. Required fields are marked *

Share via
Copy link