How to configure nginx file server in windows10 system

WBOY
Release: 2023-05-16 17:55:06
forward
3109 people have browsed it

nginx official website Download the windows version of nginx:

How to configure nginx file server in windows10 system

Unzip the downloaded software package:

Note:

The path to the decompressed package cannot contain Chinese characters, otherwise the nginx service cannot be started


How to configure nginx file server in windows10 system

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>
Copy after login

How to configure nginx file server in windows10 system

After the service is started successfully, there will be two in the task manager "nginx" process

How to configure nginx file server in windows10 system

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 ;
}
Copy after login

Reload the nginx service

# 重新加载nginx服务命令
f:\gx\nginx-1.16.1>nginx.exe -s reload

f:\gx\nginx-1.16.1>
Copy after login

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:

How to configure nginx file server in windows10 system

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
Copy after login

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

How to configure nginx file server in windows10 system

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template