Showing
1 changed file
with
39 additions
and
0 deletions
新员工入职培训/Nginx_learn.md
0 → 100644
1 | +#Nginx入门&配置 | ||
2 | +##windows安装 | ||
3 | +官网下载nginx-1.8.1.zip,解压 | ||
4 | +##启动Nginx | ||
5 | +默认配置在conf/nginx.conf | ||
6 | +启动 nginx.exe | ||
7 | +浏览器访问localhost:80/ 成功显示 Welcome to nginx! | ||
8 | + | ||
9 | +###常用命令 | ||
10 | +| 名称 | 命令 | | ||
11 | +| :-- | :-- | | ||
12 | +| 关闭 | nginx -s stop | | ||
13 | +| 重启 | nginx -s reopen | | ||
14 | +| 重新load | nginx -s reload | | ||
15 | + | ||
16 | + | ||
17 | +##配置测试APP 访问dev环境 | ||
18 | +1.配置Fiddler与手机网络代理,让手机通过自己机器间接访问服务 | ||
19 | +2.配置hosts 添加域名 127.0.0.1 testapi.yoho.cn | ||
20 | +3.配置nginx(nginx.conf) 添加server节点: | ||
21 | +``` | ||
22 | + server | ||
23 | + { | ||
24 | + #testapi的默认访问端口 | ||
25 | + listen 28078; | ||
26 | + server_name localhost; | ||
27 | + location / { | ||
28 | + proxy_redirect off; | ||
29 | + proxy_set_header Host $host; | ||
30 | + proxy_set_header X-Real-IP $remote_addr; | ||
31 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
32 | + #devapi访问路径 | ||
33 | + proxy_pass http://devapi.yoho.cn:58078; | ||
34 | + } | ||
35 | + #访问路径 | ||
36 | + access_log logs/dev_access.log; | ||
37 | + } | ||
38 | +``` | ||
39 | +4.启动nginx,手机app访问转到dev环境 |
-
Please register or login to post a comment