複数のドメインを同じEC2インスタンスに移動したいと思います。すべてが同じIPを持つでしょう。私はdomain1.comとdomain2.comとして複数のvhostファイルを設定しています。私はhtaccessファイルやvhostファイルに特別なものはありません。私はGoDaddyを通してドメインを持っています、彼らはEC2 IPを指しています。私が持っている問題は、ドメイン1と2が同じフォルダに移動し、同じindex.htmlをブラウザに表示することです。AWS EC2 LAMP Vhostsがすべて同じフォルダを指しています
https://help.ubuntu.com/lts/serverguide/httpd.htmlによると、私はhttpd.confがもう存在しないことを知り、幽霊のためにapache2.confに何も表示されません。
敗走53を使用していない
*(あなたは、私が試してみましたコメントアウト物事を見ることができるように)私はあまりに*
バーチャルホストファイルを持っていない限り、私は、これを使用したくない:
(ドメイン1)
#SSLStaplingCache shmcb:/tmp/stapling_cache(128000)
SSLStaplingCache shmcb:${APACHE_RUN_DIR}/ssl_stapling_cache(128000)
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName domain1.com
ServerAlias www.domain1.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
SSLUseStapling on
RewriteEngine on
#RewriteRule domain1.com\/$ http://domain1.com [NC]
RewriteCond %{SERVER_NAME} =domain1.com [OR]
RewriteCond %{SERVER_NAME} =domain1.com
RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
(ドメイン2)
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName domain2.com
ServerAlias www.domain2.com
DocumentRoot /var/www/html/domain2.com
# ServerPath "/domain2.com/"
# RewriteEngine On
# RewriteRule "^(/domain2.com/.*)" "/html/domain2.com$1"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/domain2.com>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
#RewriteEngine on
#RewriteRule domain2.com\/$ http://domain2.com/index.php [NC]
</VirtualHost>
デフォルト-のssl.confファイル:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin [email protected]
ServerName domain1.com
DocumentRoot /var/www/html/domain1.com
*********** EDIT ****************
apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2017-09-18T15:09:02
sudo apachectl configtest
Syntax OK
私はバーチャルホストファイルに "sudoをa2ensite" コマンドを完了し、それらの後
******* EDITをApacheを再起動した****************
ホストの:
127.0.0.1 localhost
127.0.1.1 domain1.com
127.0.1.2 domain2.com
私は質問を編集しました。詳細が必要な場合はお知らせください。私は、ホストファイルをセットアップするときにコマンドを完了しました。しかし、ドメインは依然として同じフォルダを指していました。 – ThomasC
2つの設定ファイルがありますか? 1つの仮想ホストごとに1つ? 各ファイルは "/ etc/apache2/sites-available /"フォルダ内にある必要があります。 – JPaulino
はい私は2つのファイルを持っています。ドメインごとに1つ。ドメイン内のdomain1.confとdomain2.confが利用可能です – ThomasC