2013年3月20日水曜日

apache2 その3

 _| ̄|_    //ヽ\
 |      '|/ / ノ  "´ ̄ ̄''''‐-...ノヽ
 |__|'' ̄!  !    /            丶 |
   ,‐´ .ノ''   /  ,ィ             \
   ヽ-''"   7_//         _/^ 、 `、
┌───┐  /          / 、_(o)_,;j ヽ|
|┌─,  .|  /.           -   =-{_(o)
└┘ ノ ノ   |/        ,r' / ̄''''‐-..,>
   //   {         i' i    _   `ヽ
          ̄フ       i' l  r' ,..二''ァ ,ノ
   n      / 彡       l  /''"´ 〈/ /
   ll     _ > .  彡    ;: |  !    i {
   l|       \ l 彡l     ;. l |     | !
   |l      トー-.   !.    ; |. | ,. -、,...、| :l
   ll     |彡     l    ; l i   i  | l
   ll     iヾ 彡     l   ;: l |  { j {
   |l     { 彡|.      ゝ  ;:i' `''''ー‐-' }
. n. n. n  l 彡   ::.   \ ヽ、__     ノ
  |!  |!  |!   l彡|    ::.     `ー-`ニ''ブ
  o  o  o   l      :.         |


上手くいかない・・・
2個とも同じものを見てしまう・・・

NameVirtualHost ●.●.●:80
<VirtualHost *:80>
ServerAdmin info@test.jp
ServerName test.jp
DocumentRoot /var/www/tests

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/tests/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>



NameVirtualHost ●.●.●.●:81

ServerAdmin info@hogehoge.co.jp
ServerName hogehoge.co.jp
DocumentRoot /var/www/hogehoge

Options FollowSymLinks
AllowOverride None

Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all


ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

何が問題なんだろう。。。
http://pokotsun.mydns.jp/?p=770

新しい記事を読み込む
一旦hogehoge.o.jpの方を解除
test.jpを残し、編集


結果、自分の頭がどうかしてた。


そもそもの考え方がイカンかった。


NameVirtualHost 27.96.63.134:80
<VirtualHost *:80>
ServerAdmin info@hogehoge.co.jp
ServerName hogehoge.co.jp
DocumentRoot /var/www/hogehoge_co
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/hogehoge_co/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
/span>
ErrorLog ${APACHE_LOG_DIR}/hogehoge_co_error.log
/span>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
/span>
CustomLog ${APACHE_LOG_DIR}/hogehoge_co_access.log combined
</VirtualHost>

<VirtualHost *:80>
ServerAdmin info@test.co.jp
ServerName test.co.jp
DocumentRoot /var/www/test_co

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/test_co/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog ${APACHE_LOG_DIR}/test_co_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/test_co_net_access.log combined
</VirtualHost>


今回書いたのがこれ
今まで、NAMEベースって言うのはポートでどのサイトかを判別していると思ってたけど <VirtualHost *:80>


<VirtualHost *:81>

どうも違うのね
振り分けてるのはServerName hogehoge.co.jp
これだと判断する。
今度はここを双方のドメインにしつつポートを揃えて、なおかつ設定ファイル。この場合は/sites-available/test.jpファイル1枚で作成してみた。
結果、

                      /
                    /
                       ` ー
                       _,.>
                      r "
     うごいた!        \    _
                         _ r-''ニl::::/,ニ二 ーー-- __
                     .,/: :// o l !/ /o l.}: : : : : : :`:ヽ 、
                   /:,.-ーl { ゙-"ノノl l. ゙ ‐゙ノノ,,,_: : : : : : : : : :ヽ、
               __l>ゝ、,,ヽ /;;;;;;;;;;リ゙‐'ー=" _゛ =、: : : : : : : :ヽ、
              /  _________`゙ `'-- ヾ_____--⌒     `-: : : : : : : :
...-''"│    ∧  .ヽ.  ________   /   ____ ---‐‐‐ーー    \: : : : :
    !   /   .ヽ  ゙,ゝ、      /  ________rー''" ̄''ー、    `、: : :
    .l./     V   `'''ー-、__/__r-‐''"゛     ̄ ̄   \   ゙l: : :
                   l     .,.. -、、 _ ‐''''''''-、    l   !: :
                  |   /    .| .!     `'、  |   l: :
                      l   |     .l,,ノ     |  !   !: :
                       / '゙‐'''''ヽ、 .,,,.. -''''''''^^'''-、/  l   !: :
             r―- ..__l___    `´            l   /   /: :
                \      `゙^''''''―- ..______/_/   /: : :
                `


チクショウ、チクショウorz


------------------------------------------------------------------------------
続き

1枚の設定ふぁいるで動いたので

今度は再び2枚に戻す

ファイルを作り sudo a2ensite hogehoe
で設定ファイルのシンボリックを貼る。

sudo /etc/init.d/apache2 restart
でアパッチを再起動

問題なく分けられてる!!!!



以上で設定を完了します。


いずれNAMEベースのデメリットとかも勉強していこうと思う。

http://uturo1.nevernothing.jp/apache2namebase/


0 件のコメント :

コメントを投稿