一 : 业务目的:
使用nginx代理本地文件,使本地文件能供通过 localhost/test/index.html 路径 访问本地磁盘C:\Users\dengwubo\Desktop\test\index.html 目录
二: 实现步骤
-
下载nginx ---怎么下载就不谈了.
-
配置nginx.config
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
#location / {
#proxy_pass http://127.0.0.1:8080;
# }
# location /api/ {
# proxy_pass http://127.0.0.1:8088/;
# }
location /test {
root C:\Users\dengwubo\Desktop; # root 指的是匹配到"/" ,请大家参考
index index.html;
}
}
}
网友评论