我有一台运行基本LAMP堆栈的Amazon EC2 linux 14.04LTS服务器,我有两个域4techgroups.com
和ecommercejiban.shop
。
从Godaddy购买4techgroups.com
时,ecommercejiban.shop
尚未购买。
/etc/apache2/sites-available/
上我的EC2服务器上的配置文件是001-4techgroups.conf
和002-ecommercejiban.shop
我的001-4techgroups.conf
看起来像这样
<VirtualHost *:80>
ServerName www.4techgroups.com
ServerAlias 4techgroups.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/4tech
<Directory "/var/www/html/4tech">
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/4techerror.log
CustomLog ${APACHE_LOG_DIR}/4techaccess.log combined
</VirtualHost>
我的002-ecommercejiban.shop
看起来像这样。
<VirtualHost *:80>
ServerName www.ecommercejiban.shop
ServerAlias ecommercejiban.shop
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/jibancommerce
<Directory "/var/www/html/jibancommerce">
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/jibancom-error.log
CustomLog ${APACHE_LOG_DIR}/jibancom-access.log combined
</VirtualHost>
我在EC2上重启了服务器。
现在,因为我没有购买ecommercejiban.shop
域名,所以我去了我家的本地ubuntu 14.04机器,并在/etc/hosts
52.24.182.161 ecommercejiban.shop
我重启服务器很多次,我可以访问4techgroups.com网站,但我无法访问我的ecommercejiban.shop。但我已经编辑了我的本地主机文件,无论如何都指向该服务器。那么为什么我的第二个域名ecommercejiban.shop无效。
从本地计算机添加nslook ecommercejiban.shop输出
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
Name: ecommerce-jiban.shop
Address: 92.242.132.24
我认为/etc/apache2/sites-enabled/
lrwxrwxrwx 1 root root 35 Jun 18 2016 000-default.conf -> ../sites-available/000-default.conf
lrwxrwxrwx 1 root root 37 Dec 30 20:45 003-ecommerce.conf -> ../sites-available/003-ecommerce.conf
lrwxrwxrwx 1 root root 53 Oct 20 2016 006-drupal-theme-installation.conf -> ../sites-available/006-drupal-theme-installation.conf
lrwxrwxrwx 1 root root 47 Nov 12 2016 007-portfolio-otherport.conf -> ../sites-available/007-portfolio-otherport.conf
lrwxrwxrwx 1 root root 35 Nov 13 2016 008-student.conf -> ../sites-available/008-student.conf
lrwxrwxrwx 1 root root 43 Jan 16 2017 014-drupal-practice.conf -> ../sites-available/014-drupal-practice.conf
lrwxrwxrwx 1 root root 43 Feb 26 2017 017-drupal-property.conf -> ../sites-available/017-drupal-property.conf
lrwxrwxrwx 1 root root 33 Apr 23 2017 019-hacka.conf -> ../sites-available/019-hacka.conf
lrwxrwxrwx 1 root root 37 Aug 27 12:24 025-multisite.conf -> ../sites-available/025-multisite.conf