我没有得到它,我希望你能够提供帮助。
我有3个域和一个服务器。我想通过右侧DirectoryRoot上的端口80获取所有3个域。但我无法做到这一点。使用我当前的站点可用/默认文件,它们都链接到同一目录(domain3)。
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
ServerName www.domain1.tld
ServerAlias *.domain1.tld
DocumentRoot /var/www/domains/domain1/
<Directory /var/www/domains/domain1/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ServerName www.domain2.tld
ServerAlias *.domain2.tld
DocumentRoot /var/www/domains/domain2/
<Directory /var/www/domains/domain2>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ServerName www.domain3.tld
ServerAlias *.domain3.tld
DocumentRoot /var/www/domains/domain3/
<Directory /var/www/domains/domain3>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
答案 0 :(得分:1)
您应该执行以下操作:
rm / etc / apache2 / sites-enabled / default
001-domain1的
<VirtualHost *:80>
ServerName www.domain1.tld
DocumentRoot /var/www/domains/domain1
</VirtualHost>
002-DOMAIN2
<VirtualHost *:80>
ServerName www.domain2.tld
DocumentRoot /var/www/domains/domain2
</VirtualHost>
003-DOMAIN3
<VirtualHost *:80>
ServerName www.domain3.tld
DocumentRoot /var/www/domains/domain3
</VirtualHost>
a2ensite 001-domain1
a2ensite 002-domain2
a2ensite 003-domain3
/etc/init.d/apache2 restart
答案 1 :(得分:0)
你必须在这里使用虚拟主机是教程。
试试这个
<VirtualHost *:80>
DocumentRoot /var/www/domains/domain1/
ServerName www.domain2.tld
ServerAlias *.domain2.tld
</VirtualHost>