1、打开C:\Windows\System32\drivers\etc
其中有host文件,打开修改127.0.0.1映射到目标域名,默认是localhost,我们可以自行修改
2、本地下载nginx
打开nginx.conf修改如下,server_name我们为127.0.0.1,然后会映射到我们在host文件设定的目标域名,就可以使用目标域名访问。
#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 127.0.0.1;
location / {
alias D:/GitCode/tapa-site/gdevBuild/;
index index.html index.htm;
}
location /api/ {
client_max_body_size 200M;
proxy_pass http://apis-dev.newegg.org/tapa/v1/api/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
网友评论