LoginSignup
12
15

More than 5 years have passed since last update.

apache/ubuntuでvirtual hostを設定したメモ

Posted at

ubuntuのバージョン

$  cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.1 LTS"

ドメインのゾーン編集

※sakuraインターネットで借りた。

エントリ名 タイプ データ
@ NS default
@ NS default
@ A [your IP]
@ MX 10 @
mail CNAME @
ftp CNAME @
www A [your IP]
* CNAME www

apacheの設定

 vi /etc/apache2/sites-available/virtual.host

下記のような感じでかく。
<VirtualHost *:80>
    ServerName sub.example.com
    ServerAdmin webmaster@virtual.host
    DocumentRoot  /path/to/sub/doc
    ErrorLog /var/log/apache2/virtual.host.error.log
    CustomLog /var/log/apache2/virtual.host.access.log combined
    LogLevel warn
</VirtualHost>

有効化

$ a2ensite virtual.host 
↓
/etc/apache2/sites-enabledにsymlinkができる

再起動

$ sudo service apache2 reload

確認

下記二つが正しく表示されているか確認

12
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
15