Re: バーチャルドメインでwww抜かすとリアルドメインが表示される
( No.1 )
|
 |
- 日時: 2006/02/14 06:59
- 名前: ももんが
-
>wwwを付けてバーチャルドメインを入力すると、(例:www.virtual.com)
>バーチャルドメインのサイトが表示される(OK)
>しかし、www.を付けないで、バーチャルドメインのみを入力すると、(例:virtual.com) >リアルドメインのサイト内容が表示されます。
それで良いのではないか?
>awstats
httpdでバーチャルホストを設定したときログの出力先を変更したからですよ。 awstats.pl(awstats.confだったかな?)にどのログを読むか指定する場所があるはず。
|
Re: バーチャルドメインでwww抜かすとリアルドメインが表示される
( No.2 )
|
 |
- 日時: 2006/02/14 07:33
- 名前: 管理者
-
<VirtualHost>ディレクティブ内の「ServerAlias」にワイルドカードの指定とドメイン名だけの追加指定をしてみてはどうでしょうか?
例)(複数指定する場合は、半角スペースで区切る) <VirtualHost *:80> ServerAlias virtual.com *.virtual.com : :
|
Re: バーチャルドメインでwww抜かすとリアルドメインが表示される
( No.3 )
|
 |
- 日時: 2006/02/14 11:44
- 名前: よろしくお願い致します。
<info@shiawase-home.com>
- 参照: http://www.shiawase-home.com
-
>管理人さん・ももんがさん
バーチャルドメインについて
/etc/httpd/conf.d/virtualhost.conf にバーチャルドメインの追加を行ったら上手くいきました。 ただし、バーチャルドメインをスペースで区切って記載するとエラーになるので、 同じ文章を2度記載しました。
ただし、ServerAlias というのが分からず、ServerNameでの設定をしています。 (これでいいのかなぁ?)
NameVirtualHost *:80
<VirtualHost *:80> ServerName www.shiawase-home.com DocumentRoot /var/www/html ErrorLog logs/shiawase_error_log CustomLog logs/shiawase_access_log common </VirtualHost>
<VirtualHost *:80> ServerName www.virtual.com DocumentRoot /var/www/html/virtual ErrorLog logs/midori_error_log CustomLog logs/midori_access_log common </VirtualHost>
<VirtualHost *:80> ServerName virtual.com DocumentRoot /var/www/html/virtual ErrorLog logs/midori_error_log CustomLog logs/midori_access_log common </VirtualHost>
**************************************
>ももんがさん
awstats に必要なログの場所が変わっていたと思います。 なるほどと思いました。 これを元にどうにかしたいと考えています。
**************************** ところで 私の解釈では、新しいリアルドメインのログ出力先は、
/etc/httpd/logs/shiawase_access_log
と理解しているのですが、この解釈は正しいでしょうか?
**************************
awstatsについては、上手くいっていないので、もう少し詳しく教えて下さい。
ログはリアルドメインとバーチャルと両方とりたいところですが、 とりあえず、リアルドメインのみ取れればよいと思っています。 (両方可能ならばその方が良いです。) その際に、設定は以下のようで宜しいでしょうか? ちなみに、以前に一度awstatsは構築しているので、 /usr/local/awstats/wwwroot/cgi-bin/conv_weblog_to_utf8.pl などはあります。
現在
1./etc/httpd/conf.d/virtualhost.conf の設定は以下になります。
<VirtualHost *:80> ServerName www.shiawase-home.com DocumentRoot /var/www/html ErrorLog logs/shiawase_error_log CustomLog logs/shiawase_access_log common </VirtualHost> 以下省略 ・・・・・・・・・・
それに対して、以下のように設定しようとしたのですが、上手くいません。
2./etc/awstats/awstats.shiawase-home.com.confのログファイル先変更
LogFile="/etc/httpd/logs/shiawase_access_log"
3.vi /root/awstats.sh作成
#!/bin/bash /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=shiawase-home.com
4./root/awstats.sh実行
ここでエラーになります。
Update for config "/etc/awstats/awstats.shiawase-home.com.conf" With data in log file "/etc/httpd/logs/shiawase_access_log"... Phase 1 : First bypass old records, searching new record... Direct access to last remembered record is out of file. So searching it from beginning of log file... AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log. Your log file /etc/httpd/logs/shiawase_access_log must have a bad format or LogFormat parameter setup does not match this format. Your AWStats LogFormat parameter is: 1 This means each line in your web server log file need to have "combined log format" like this: 111.22.33.44 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" And this is an example of records AWStats found in your log file (the record number 50 in your log): 60.236.69.2 - - [14/Feb/2006:10:51:34 +0900] "GET /images/box4/box4_r2_c1.gif HTTP/1.1" 200 197 Setup ('/etc/awstats/awstats.shiawase-home.com.conf' file, web server or permissions) may be wrong. Check config file, permissions and AWStats documentation (in 'docs' directory).
以上が上手くいくようならば、以下の手順をもう一度しようと思っていました。
5.apacheログファイルのコンバート実行 /usr/local/awstats/wwwroot/cgi-bin/conv_weblog_to_utf8.pl \ < /etc/httpd/logs/access_log \ > /etc/httpd/logs/access_log.enc
6./etc/awstats/awstats.shiawase-home.com.confのログファイル先変更
LogFile="/etc/httpd/logs/access_log.enc"
7.シェルスクリプト再度作成(CPU負荷を軽減)
vi /root/awstats.sh
|
分かりました。
( No.4 )
|
 |
- 日時: 2006/02/14 19:03
- 名前: よろしくお願い致します。
<info@shiawase-home.com>
- 参照: http://www.shiawase-home.com
-
/etc/httpd/conf.d/virtualhost.conf の設定で
<VirtualHost *:80> ServerName www.shiawase-home.com DocumentRoot /var/www/html ErrorLog logs/shiawase_error_log CustomLog logs/shiawase_access_log common </VirtualHost> 以下省略 ・・・・・・・・・・ の、CustomLog logs/shiawase_access_log common
をcombind に変えても駄目だったので不思議だったのですが、以下が原因だったようです。
今まで保存されていた logs/shiawase_access_log common は古いcommon 形式で保存されているため 単純に設定をcombind に変えるだけでは駄目なようです。
一度logs/shiawase_access_log common を mv でリネーム(単純にバックアップとして) 新たにlogs/shiawase_access_log commonをつくり直させたところ ログを読み込むようになりました。
エラーログを読んでも不思議だったのですが、 設定を変えただけでは駄目だ、ということが分かりました。
色々と有難うございました。
|
Re: バーチャルドメインでwww抜かすとリアルドメインが表示される
( No.5 )
|
 |
- 日時: 2006/02/14 20:12
- 名前: ももんが
<momonganet@jcom.home.ne.jp>
-
>新たにlogs/shiawase_access_log commonをつくり直させたところ
logs/shiawase_access_log combind ですよね?(^-^)
一回commonでログをつくりはじめると、消さないとダメなんですね。勉強になりました。
|
Re: バーチャルドメインでwww抜かすとリアルドメインが表示される
( No.6 )
|
 |
- 日時: 2006/02/14 20:45
- 名前: よろしくお願い致します。
<info@shiawase-home.com>
- 参照: http://www.shiawase-home.com
-
>ももんがさん
あ、その通りです。 記載ミスです。
細かなところが、こちらのサイトの設定(ログの指定)と若干異なるので(当たり前ですが) 念のため、成功した設定をアップしておきます。 (ホスト名は変更してあります)
1./etc/httpd/conf.d/virtualhost.conf の今までの設定は以下です。
<VirtualHost *:80> ServerName www.real.com DocumentRoot /var/www/html ErrorLog logs/real_error_log CustomLog logs/real_access_log common </VirtualHost> 以下省略 ・・・・・・・・・・
上記common が問題(バーチャルドメインの場合、/etc/httpd/conf/httpd.conf もそうなのかもしれませんが、/etc/httpd/conf.d/virtualhost.confにおいてもcombindの修正が必要)
2.上記CustomLog logs/real_access_log common の変更
CustomLog logs/real_access_log combind
3.logs/real_access_log の再構築
今までのままではcommon 設定の為、一度combind に設定しなおしたログにする (全て変換する方法もあるのでしょうけど、私は分からないので以下にしました。)
今までの古いログを別名でリネーム mv /etc/httpd/logs/real_access_log /etc/httpd/logs/real-backup_access_log
とりあえず放っておけば、新しいログが作成
4./etc/awstats/awstats.real.com.confのログファイル先変更
LogFile="/etc/httpd/logs/real_access_log"
5.vi /root/awstats.sh作成
#!/bin/bash /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=real.com
6./root/awstats.sh実行
7.apacheログファイルのコンバート実行 /usr/local/awstats/wwwroot/cgi-bin/conv_weblog_to_utf8.pl \ < /etc/httpd/logs/real_access_log \ > /etc/httpd/logs/real_access_log.enc
8./etc/awstats/awstats.real.com.confのログファイル先変更
LogFile="/etc/httpd/logs/real_access_log.enc"
9.シェルスクリプト再度作成(CPU負荷を軽減の説明と同じ)
vi /root/awstats.sh
・・・と続く
|