【发布时间】:2011-07-28 13:20:48
【问题描述】:
如何在没有任何 Cpanel(cPanel、plesk 或 ...)并使用 shh 的情况下将域停放在基于 CentOS 的 VPS 上?
【问题讨论】:
-
这取决于您使用的 DNS 和 HTTP 服务器。 (假设“公园”是指“托管单个网页”)
如何在没有任何 Cpanel(cPanel、plesk 或 ...)并使用 shh 的情况下将域停放在基于 CentOS 的 VPS 上?
【问题讨论】:
您可以编辑 httpd.conf 并在虚拟主机部分下的 ServerName 部分中添加您的域。如果您的 DNS 没有指向您的网络服务器,您也需要这样做(这是 cpanel 等的优势之一,它可以为您执行此操作,但与此同时,您会想知道它做了什么)
类似
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ServerName test.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
【讨论】:
我假设你有 DNS(即 Godaddy 的,或者你的 VPS 有一个)。
编辑你的文件/etc/httpd/conf/httpd.conf
在底部添加(使用您的域名作为 ServerName,使用您的文件夹作为 DocumentRoot):
<VirtualHost *:80>
ServerAdmin root@localhost
DocumentRoot /home/examplecom/www/
ServerAlias example.com
ServerName www.example.com
ErrorLog logs/www.example.com-error_log
CustomLog logs/www.example.com-access_log common
<Directory /home/examplecom/www/>
Options FollowSymLinks
AllowOverride All
</Directory>
</VirtualHost>
目录是可选的,但这对我有用。
比以“root”身份访问 SSH 并重置 Apache 服务器:
service httpd restart
【讨论】: