apache - 在 Ubuntu 和 Apache 下的 VPS 上设置子域时遇到问题

标签 apache ubuntu subdomain vps

在服务器方面我完全是个新手,所以我需要一些帮助。基本上,我想在我的 VPS 上有一个子域。我不太关心文件所在的位置,当然我希望尽可能将它们分开。

我找到了一个 guide这样做基本上可以将过程总结为五个步骤:

  1. Create directories to host the content of a new virtual site.
    1. Make a copy of the /etc/apache2/sites-available/defaults file with a site appropriate name.
    2. Change the two /var/www/ entries to the actual directory of the new site.
    3. Add the ServerName line with the real domain name you will be hosting.
    4. Use a2ensite to enable the new site, and finally reload Apache2 so it knows about the new site

我尝试了所有这些,但我无法让它工作。在此过程中,我在任何时候都没有遇到任何错误,但是当我在浏览器中输入带有子域的地址时,出现“找不到服务器”错误。

托管我的 VPS 的公司有一个管理页面,我可以在其中设置子域。愚蠢的问题:我是否必须在执行此操作时重新配置 DNS 记录或其他内容,或者问题可能是由其他原因引起的?

附加说明:我在设置服务器时遵循了 howtoforge.com 上的指南,事后看来这可能不是我最明智的举动。有没有可能我在那里犯了一个错误,现在以某种方式影响了我?

最佳答案

假设您已经在您的 VPS 管理页面中正确设置了子域,这里唯一需要检查的是您实际上创建了您的 DNS 管理页面中的子域(是吗? ).例如,我使用 afar.org 来管理我的 DNS 记录并添加一个子域,它本质上是:

Type: A
Subdomain: sparky
Domain: example.com
Destination: 120.34.2.3 (this would be your VPS' IP address)

通常,您可以通过以下方式添加(子)域:

sparky.example.com A 120.34.2.3

请记住,您要添加一条 A 记录(这很重要!)。

关于apache - 在 Ubuntu 和 Apache 下的 VPS 上设置子域时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8997261/

相关文章:

PHP没有在子域上保存 session ,在域上可以

linux - 在 NPM/Yeoman 中作为 sudo 生成命令

apache - 如何阻止 Chrome 重定向到 HTTPS?

java - 错误 HttpClient 无法解析为类型

ruby-on-rails - 多个子域的路由

image - 用于图像 htaccess 问题的 wordpress 子域

php - 在 Mint 上设置 apache 和 php

linux - 为什么我已经设置了它,但仍然说没有 GOPATH?

c# - 在 Rider 中反编译 ASP.NET Core 3.x 源代码

ubuntu - 北美的 openstreetmap 服务器需要多少空间?