nginx代理

1、下载

http://nginx.org/en/download.html 

2、启动

a、直接双击nginx.exe 

b、cmd 命令:nginx.exe 或者 start nginx

3、检查nginx是否启动成功

http://localhost:80

4、关闭nginx

a、nginx -s stop 或者 nginx -s quit

b、使用 taskkill /f /t /im nginx.exe (优先使用)

5、代理配置

  nginx的配置文件是conf目录下的nginx.conf,默认端口为80,如需要可自定义。

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
#这里配置你自己的访问ip proxy_pass http:
//127.0.0.0.1:8000;

 注意:如果改了nginx的端口号,则访问路径的时候需要加上端口号。比如 url = http://localhost:8888

posted @ 2020-08-09 09:18  悟道_ms  阅读(287)  评论(0编辑  收藏  举报