Last active
August 29, 2015 14:04
-
-
Save jeremy16601/fc1ca35e6d747cd3946d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nginx 配置 nodejs反向代理 | |
## nginx 安装 | |
1. 下载最新的nginx 官网 1.7 版本. | |
2. ./configure 然后 make ,make install | |
3. 默认安装位置/etc/nginx/ | |
4. 进入 sites-enabled --- 创建个新文件,例如 wechat.conf | |
5. vim wechat.conf | |
-- server{ | |
listen 80; | |
server_name www.10gejin.com; | |
#location 配置 | |
location ^~ /weixin/ { | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-For $remote_addr; | |
#配置node 监听的端口 | |
proxy_pass http://127.0.0.1:3000; | |
} | |
} | |
保存 | |
6. 进入/etc/nginx/nginx.conf | |
-- 在http节点下 加上 | |
-- include /etc/nginx/sites-enabled/*; | |
7. nginx restart | |
######node 配置 安装######### | |
1. 下载源码 编译安装,安装模块 | |
2. npm install -g pm2 或者forever | |
3 个人推荐pm2+nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment