因此,我花了几个小时在 Google 上查找有关如何设置多个域名的信息,但我打算放弃了。
这是我最近的尝试:
端口.conf:
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
# NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to <VirtualHost *:443>
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
站点可用/data.paulbgd.me:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.data.paulbgd.me
ServerAlias data.paulbgd.me
# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /var/www/data.paulbgd.me/
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/data.paulbgd.me/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /var/www/data.paulbgd.me/logs/error.log
CustomLog /var/www/data.paulbgd.me/logs/access.log combined
</VirtualHost>
apache 重启时没有错误。域的 DNS 已将其记录设置为我的 VPS 的 IP。
编辑:忘了提一件事。当我进入域名时,我没有看到“无法连接”页面,而只是看到一个空白页。关于这一点:
/var/www/data.paulbgd.me/index.php:
<h2>Works!</h2>