1、首先找到/usr/local/nginx/conf外面的nginx.conf。
2、批改http外面的server。
一、动态网站配置,内部拜访www.abc.com就是拜访服务器上的html目录里的文件
http {
server {
listen 80;
server_name www.abc.com;//拜访地址
location / {
root html;//网站源码搁置的门路
index index.html index.htm;//默认首页
}
error_page 404 /404.html;
}
}
二、node反向代理,内部拜访www.efg.com就是拜访服务器上的http://127.0.0.1:8888
http {
server {
listen 80;
server_name www.efg.com;//拜访地址
location / {
proxy_redirect off;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 60;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8888;//服务器上的node的拜访地址
}
}
}
发表回复