我已经在node中创建了我的网站。我为不同的模块使用了不同的端口。
像http://localhost:5555/一样,这是为管理员准备的,
http://localhost:5050/这是用于客户端访问的。‘
我使用的是Digitalocean Ubuntu服务器,我已经从Godaddy购买了域名。
我想在不同的端口上设置不同的域。
喜欢
http://localhost:5555/应为"http://admin.example.com“。
http://localhost:5050/应为"http://example.com“。
我尝试过在Ubuntu中使用nginx,但是没有得到任何有用的东西。
请帮帮我。提前谢谢。
发布于 2015-07-22 20:29:28
您的nginx配置文件中需要两个server配置,一个用于管理子域,另一个用于example.com本身。它应该看起来像这样:
server {
listen 80 default;
server_name example.com .example.com ;
location / {
proxy_pass http://localhost:5050;
proxy_pass_header Server;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
}和
server {
listen 80;
server_name admin.example.com;
location / {
proxy_pass http://localhost:5555;
proxy_pass_header Server;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
}
}https://stackoverflow.com/questions/31545798
复制相似问题