在服务器方面我完全是个新手,所以我需要一些帮助。基本上,我想在我的 VPS 上有一个子域。我不太关心文件所在的位置,当然我希望尽可能将它们分开。
我找到了一个 guide这样做基本上可以将过程总结为五个步骤:
- Create directories to host the content of a new virtual site.
- Make a copy of the /etc/apache2/sites-available/defaults file with a site appropriate name.
- Change the two /var/www/ entries to the actual directory of the new site.
- Add the ServerName line with the real domain name you will be hosting.
- 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/