Apache/開発用のサブドメインを設定する

Linux Mint 16, Apache 2.4.6 多分 Ubuntu 系でも同じだと思う

このディレクトリ以下にURLとディレクトリの関係を記述するファイル群があるのでここにおく

/etc/apache2/sites-available

すでにデフォルトのやつが設定されているのでそれをコピー

$ sudo cp 000-default.conf 001-hogehoge.conf

このように編集 ServerName を追加しているところがポイント

<VirtualHost *:80>
    ServerName hoge.hoge.com
    ServerAdmin webmaster@localhost
    DocumentRoot /home/hoge/piyo/fuga
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<Directory "/home/hoge/piyo/fuga">
    AllowOverride All
    Require all granted
</Directory>

Apache2.4 からは Directory にこのような記述が必要になったようだ。

勝手ドメインを作る

/etc/hosts

127.0.0.1       hoge.hoge.com

を追記してOK

Tag

linux/distribution/linux_mint/linux_mint_16/apache/setup_sub_domain_for_dev.txt · 最終更新: 2019-11-22 09:56 by ore