2011|08|
2013|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|05|06|07|08|09|10|11|12|
2016|01|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|

2020-02-24 Route53で作ったサブドメインをapach2のサーバに繋ぐ方法 [長年日記]

Route53で、サブドメイン(admin.sea-anemone.tech,passenger.sea-anemone.tech, vehicle.sea-anemone.tech)を作ったがいいが、全部同じページに飛ぶので、変だなぁ、と思っていたが、考えてみたら、サブドメイン用の設定、何もしていななかったことに気がついた。

因みに、つかっているwebサーバは"apache2"

Server version: Apache/2.4.29 (Ubuntu)
Server built:   2019-09-16T12:58:48

/var/www/html/ には、

admin  index.html  passenger  vehicle
の3つのディレクトリを作って、それぞれのディレクトリに、"index.html"を作った

そんでもって、/etc/apache2/sites-available の、000-default.conf の下の方に20行ほど追加したものが以下の通り。

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com
 
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
 
        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn
 
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
 
        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>
 
 
<VirtualHost *:80>
        ServerName admin.sea-anemone.tech
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/admin
</VirtualHost>
 
<VirtualHost *:80>
        ServerName passenger.sea-anemone.tech
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/passenger
</VirtualHost>
 
<VirtualHost *:80>
        ServerName vehicle.sea-anemone.tech
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/vehicle
</VirtualHost>
 
 
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
 
 

あとは、

http://admin.sea-anemone.tech
http://passenger.sea-anemone.tech
http://vehicle.sea-anemone.tech

にアクセスして試してみる。