バーチャルホスト設定(Virtual Host Domain Name Management)

最終更新日: 2014.02.19

<<トップページ <<新着情報 <<サイト内検索 <<CentOSで自宅サーバー構築 <<Scientific Linuxで自宅サーバー構築

■概要

Webmailシステム上で、メールアドレスwebmaster@fedorasrv.comの他に、webmaster@example.dip.jpでもメールを送受信できるようにする。
ここでは、SquirrelMailのプラグインであるVirtual Host Domain Name Managementをインストールして、webmaster@fedorasrv.comと、webmaster@example.dip.jpでメールを送受信できるようにする。

Webサーバー間通信内容暗号化Webサーバーバーチャルホスト、メールサーバーバーチャルドメイン(Postfix編)設定済であること
なお、メールサーバーバーチャルドメイン(qmail編)では設定不要



■Virtual Host Domain Name Managementインストール

[root@fedora ~]# wget http://www.squirrelmail.org/countdl.php?fileurl=http%3A%2F%2Fwww.squirrelmail.org%2Fplugins%2Fvirtual_hosts-1.0.tar.gz
 ← Virtual Host Domain Name Managementダウンロード

[root@fedora ~]# cd /var/www/webmail/plugins/ ← SquirrelMailプラグインディレクトリへ移動

[root@linux plugins]# tar zxvf /root/virtual_hosts-1.0.tar.gz ← ダウンロードしたファイルを解凍
virtual_hosts/
virtual_hosts/readme.txt
virtual_hosts/index.php
virtual_hosts/INSTALL
virtual_hosts/setup.php

[root@linux plugins]# rm -f /root/virtual_hosts-1.0.tar.gz ← ダウンロードしたファイルを削除

[root@linux plugins]# /var/www/webmail/config/conf.pl ← SquirrelMail設定スクリプト実行
SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books (LDAP)
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database

D.  Set pre-defined settings for specific IMAP servers

C.  Turn color off
S   Save data
Q   Quit

Command >> 8 ← Plugins選択

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
    1. delete_move_next
    2. squirrelspell
    3. newmail
    4. empty_trash
    5. compatibility
    6. change_passwd
    7. chg_sasl_passwd

  Available Plugins:
    8. message_details
    9. info
    10. administrator
    11. translate
    12. bug_report
    13. virtual_hosts
    14. sent_subfolders
    15. mail_fetch
    16. fortune
    17. listcommands
    18. calendar
    19. filters
    20. abook_take
    21. spamcop

R   Return to Main Menu
C.  Turn color off
S   Save data
Q   Quit

Command >> 13 ← virtual_hostsの番号を選択(番号は環境によって異なる)

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Plugins
  Installed Plugins
    1. delete_move_next
    2. squirrelspell
    3. newmail
    4. empty_trash
    5. compatibility
    6. change_passwd
    7. chg_sasl_passwd
    8. virtual_hosts

  Available Plugins:
    9. message_details
    10. info
    11. administrator
    12. translate
    13. bug_report
    14. sent_subfolders
    15. mail_fetch
    16. fortune
    17. listcommands
    18. calendar
    19. filters
    20. abook_take
    21. spamcop

R   Return to Main Menu
C.  Turn color off
S   Save data
Q   Quit

Command >> q ← q応答(設定スクリプト終了)

You have not saved your data.
Save?  [Y/n]: y ← y応答(設定保存)
Data saved in config.php

Exiting conf.pl.
You might want to test your configuration by browsing to
http://your-squirrelmail-location/src/configtest.php
Happy SquirrelMailing!
※最新版のURLはこちら確認すること

■Apache設定

https://example.dip.jp/webmail/(https=SSL)でアクセスできるようにする。
[root@linux ~]# vi /etc/httpd/conf.d/ssl.conf ← WebサーバーSSL設定ファイル編集
#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
CustomLog logs/ssl_request_log \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteLog "logs/rewrite_log"
      RewriteLogLevel 0
      RewriteCond %{HTTP_HOST} !fedorasrv.com$
      RewriteCond %{REQUEST_URI} !^/webmail/ ← 追加
      RewriteRule ^/(.*)?$ http://%{HTTP_HOST}/$1 [L,R]
    </IfModule>
</VirtualHost>

[root@fedora ~]# /etc/rc.d/init.d/httpd restart ← Apache再起動
httpd を停止中:                                            [  OK  ]
httpd を起動中:                                            [  OK  ]

■バーチャルホスト確認

http://example.dip.jp/webmail/でログインし、左側フレームに「Current Host example.dip.jp」と表示されることと、メールが送受信できることを確認。


■関連コンテンツ




▲このページのトップへ戻る

プライバシーポリシー