仅使用一个 VPS 托管两个域? [英] Hosting two domains using only one VPS?

查看:16
本文介绍了仅使用一个 VPS 托管两个域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?有人告诉我是,但我不确定.

Is it possible? Someone told me it is but I'm not sure.

如果可以,我该怎么做?我的网站所在的位置有一个/www 文件夹.如何配置 2 个不同的站点?

If its possible, how should I do it? I have one /www folder where my website lies. How can I configure 2 different sites?

推荐答案

流程是:

  1. 将两个域都指向 VPS 的 IP.

  1. Point both domains to the ip of the VPS.

配置您在 VPS 上安装的网络服务器以响应这两个域.

Configure the webserver you have installed on your VPS to answer to those two domains.

在 Nginx 和Passenger 的情况下,只需在nginx.conf 文件中添加条目即可.像这样:

In the case of Nginx with Passenger, it is a matter of adding entries to you nginx.conf file. Like this:

server {
      listen 80;
      server_name domain1;
      root /path/to/your/project;
      passenger_enabled on;
   } 
server {
      listen 80;
      server_name domain2;
      root /path/to/your/project;
      passenger_enabled on;
   }

检查您的网络服务器文档以执行类似的操作.

Check your webserver documentation to do a similar thing.

这篇关于仅使用一个 VPS 托管两个域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆