首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Nginx:为单个服务器上的不同域隐藏端口

Nginx:为单个服务器上的不同域隐藏端口
EN

Stack Overflow用户
提问于 2014-03-27 14:18:15
回答 1查看 312关注 0票数 0

我有4个域和1个服务器。我安装了nginx并放置了4页登陆页。

其中一个例子是:

代码语言:javascript
复制
server {
   listen 2000;
   root /path/to;
   index index.html;
   server_name 1.1.1.1;
   location / {
       allow all;
   }
}

我如何可以重定向我的域名为其中一个登陆页面?例如,当我打开页面http://mydomain.com时,我从address 1.1.1.1:2000获得登陆页面。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-27 16:22:54

尝尝这个。这将在不同的端口上监听。所以你必须通过example1000.com:1000来访问它。或者您可以更改所有的聆听80,并通过example1000.comexample2000.com等访问它。

代码语言:javascript
复制
server {  
  listen 1000;

  # The host name to respond to
  server_name example1000.com;

  # Path for static files
  root /sites/example1000.com/public;

  # Index
  index index.html
}

server {  
  listen 2000;

  # The host name to respond to
  server_name example2000.com;

  # Path for static files
  root /sites/example2000.com/public;

  # Index
  index index.html
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22690362

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档