Windows and Linux Applicable to all platforms
Install well Python3 Environmental Science , And add the corresponding road strength to the environment variable
Enter... On the command line Python, You know Python Is the environment ready
python
If there are the following outputs , Just explain Python The environment is ready
Python 3.9.11 (tags/v3.9.11:2de452f, Mar 16 2022, 14:33:45) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
Switch the path to the destination folder
cd D:\code\note
python -m http.server 8888
Enter... In the browser
http://127.0.0.1:8888/
You can successfully visit our HTTP File server
Apply to Linux platform
sudo apt install nginx
After installation , Enter the host in the browser IP, You can see the following interface
http://127.0.0.1
Configure the port and target path
server{
# Show directory
autoindex on;
# Show file size
autoindex_exact_size on;
# Show file time
autoindex_localtime on;
# code
charset utf-8;
# port
listen 80;
server_name localhost;
# Local file path
root /home/http_file_server;
location / {
# These files are downloaded, not browsed
if ($request_filename ~* ^.*?.(txt|doc|pdf|rar|gz|zip|docx|exe|md|xls|bin|xlsx|ppt|pptx)$){
add_header Content-Disposition attachment;
}
}
}
Restart after configuration Nginx service
sudo systemctl reload nginx
Enter... In the browser
http://127.0.0.1
You can successfully visit our HTTP File server