nginx official website Download the windows version of nginx:
Unzip the downloaded software package:
Note:
The path to the decompressed package cannot contain Chinese characters, otherwise the nginx service cannot be started
Start the nginx service:
"Windows key r key" to open the run, enter "cmd" to enter the "dos terminal"
c:\users\administrator>f: f:\>cd gx\nginx-1.16.1 # 启动命令 f:\gx\nginx-1.16.1>start nginx f:\gx\nginx-1.16.1>
After the service is started successfully, there will be two in the task manager "nginx" process
Modify the configuration file and restart nginx
above the "https server block" of the "nginx.conf" file Add the following lines
# 添加文件管理器 # 显示目录 autoindex on; # 显示文件大小 autoindex_exact_size on; # 显示文件时间 autoindex_localtime on; server { listen 8888; server_name localhost ; # 本地文件路径 # 注意不能直接以整个逻辑磁盘f:\ 为目录路径,要f:\英文目录名 root f:\gx\chiron ; }
Reload the nginx service
# 重新加载nginx服务命令 f:\gx\nginx-1.16.1>nginx.exe -s reload f:\gx\nginx-1.16.1>
Web browser access verification: Here I am in the "f:\gx\chiron" directory in advance , created a new "test.txt" file for test access address:
Note:
1. The directory name and file name must use English characters. Download normally;
2. Files with Chinese characters may display garbled characters, and when downloading, a "500 internal server error" error may be reported. Windows version of nginx related commands:
nginx -s stop //停止nginx nginx -s reload //重新加载nginx nginx -s quit //退出nginx start nginx //启动nginx
Set the PC to start automatically at c:\users\administrator\appdata\roaming\microsoft\windows\start menu\programs\startup. Generate a shortcut for "nginx.exe" to the above directory
The above is the detailed content of How to configure nginx file server in windows10 system. For more information, please follow other related articles on the PHP Chinese website!