有两个域名
a.com
b.com
一个阿里云空间
www目录下有 aaa文件夹放网站a
a.conf如下
server {
listen 80;
server_name a.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8082;
}
}
aaa网站已经跑起来了
现在想在www目录新建bbb文件夹放网站b(也是node应用)并使用b.com访问,该怎么做
新建一个b.conf 还是在a.conf里面写 该如何写 对nginx一点不了解
迷茫2017-04-17 15:35:37
It can be seen that the port used by the first Node application is 8082, so which port is used by the second Node application? I don't know, so I might as well assume that 8083 is used. Then the nginx configuration file is changed to:
server {
listen 80;
server_name a.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8082;
}
}
server {
listen 80;
server_name b.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8083;
}
}
Then, just restart nginx. There is no need to create a new nginx configuration file.