一 : 業(yè)務(wù)目的:
使用nginx代理本地文件,使本地文件能供通過(guò) localhost/test/index.html 路徑 訪問(wèn)本地磁盤C:\Users\dengwubo\Desktop\test\index.html 目錄
二: 實(shí)現(xiàn)步驟
下載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 指的是匹配到"/" ,請(qǐng)大家參考
index index.html;
}
}
}