一、下载 在http:///上下载(zip包)并解压。 二、配置conf/nginx.conf文件 1.在conf目录下新建一个"vhosts.conf"文本文件 2.将conf/nginx.con文件中server部分复制到vhosts.conf文件中,用"include vhosts.conf;"来取代原先server部分 3.在vhosts.conf中增加反向代理配置,如下:
server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } location /google { proxy_pass http://www.google.com; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
上面location /google部分是将/google 映射到http://www.google.com
四、启动与关闭 用命令行进入nginx解压位置,以下操作均为命令行操作。 1.启动:nginx 2.关闭:nginx -s stop 如果关闭不掉,则直接在进程管理器中结束所有nginx.exe进程 |
|