Help us understand the problem. What is going on with this article?

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

More than 5 years have passed since last update.

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

確認

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

http://sub.example.com

http://example.com

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした