测试环境
- Windows 10
- nginx 1.18.0
步骤
- 解压下载的压缩包,在外面新建
dic
目录
- 编辑
conf
下的配置文件nginx.conf
worker_processes 1;
events {worker_connections 1024;}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /dic/ {
root ./;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {root html;}
}
}
只在默认配置文件中加了上面这几句
location /dic/ {
root ./;
autoindex on;
}
- 开关命令
# 启动
start nginx.exe
# 重载
nginx.exe -s reload
# 敞开
nginx.exe -s quit
- 拜访
http://localhost:8080/dic/
即可看到目录下的文件
本文出自 qbit snap