web-dev-qa-db-ja.com

Apache仮想ホストを使用したサブドメインのMunin

サーバーにMuninをインストールし、サブドメインで機能するようにWebインターフェイスを構成しようとしています。サブドメインstats.mysite.comを構成し、ファイル/etc/Apache2/sites-available/stats.mysite.comを作成しました。

NameVirtualHost *:80

<VirtualHost *:80>
   ServerAdmin [email protected]
   ServerName stats.mysite.com
   ServerAlias www.stats.mysite.com
   DocumentRoot /var/cache/munin/www
   <Directory />
       Options FollowSymLinks
       AllowOverride None
   </Directory>
   LogLevel notice
   CustomLog /var/log/Apache2/access.log combined
   ErrorLog /var/log/Apache2/error.log
   ServerSignature On
</VirtualHost>

次に、次のコマンドを使用してサイトを有効にしました。

a2ensite stats.mysite.com

そしてApacheを再起動しました:

Sudo /etc/init.d/Apache2 restart

しかし、それは機能していません。ブラウザでstats.mysite.comにアクセスすると、mysite.comの内容が表示されます。私は何か間違ったことをしていますか?誰かが私を助けてくれたらとてもありがたいです。

ファイル

/etc/Apache2/httpd.conf

ServerName localhost

/etc/munin/munin.conf

# Example configuration file for Munin, generated by 'make build'

# The next three variables specifies where the location of the RRD
# databases, the HTML output, logs and the lock/pid files.  They all
# must be writable by the user running munin-cron.  They are all
# defaulted to the values you see here.
#
# dbdir /var/lib/munin
# htmldir /var/cache/munin/www
# logdir /var/log/munin
# rundir  /var/run/munin
#
# Where to look for the HTML templates
# tmpldir       /etc/munin/templates

# (Exactly one) directory to include all files from.
#
includedir /etc/munin/munin-conf.d

# Make graphs show values per minute instead of per second
#graph_period minute

# Graphics files are normaly generated by munin-graph, no matter if
# the graphs are used or not.  You can change this to
# on-demand-graphing by following the instructions in
# http://munin.projects.linpro.no/wiki/CgiHowto
#
#graph_strategy cgi

# munin-cgi-graph is invoked by the web server up to very many times at the
# same time.  This is not optimal since it results in high CPU and memory
# consumption to the degree that the system can thrash.  Again the default is
# 6.  Most likely the optimal number for max_cgi_graph_jobs is the same as
# max_graph_jobs.
#
#munin_cgi_graph_jobs 6

# If the automatic CGI url is wrong for your system override it here:
#
#cgiurl_graph /cgi-bin/munin-cgi-graph

# munin-graph runs in parallel, the number of concurrent processes is
# 6.  If you want munin-graph to not be parallel set to 0.  If set too
# high it will slow down munin-graph.  Some experiments are needed to
# determine how many are optimal on your system.  On a multi-core
# system with good SCSI disks the number can probably be quite high.
#
#max_graph_jobs 6

# Drop [email protected] and [email protected] an email everytime
# something changes (OK -> WARNING, CRITICAL -> OK, etc)
#contact.someuser.command mail -s "Munin notification" [email protected]
#contact.anotheruser.command mail -s "Munin notification" [email protected]
#
# For those with Nagios, the following might come in handy. In addition,
# the services must be defined in the Nagios server as well.
#contact.nagios.command /usr/bin/send_nsca nagios.Host.comm -c /etc/nsca.conf

# a simple Host tree
#[localhost.localdomain]
#    address 127.0.0.1
#    use_node_name yes

[stats.mysite.com]
        address 127.0.0.1

# A more complex example of a Host tree
#
## First our "normal" Host.
# [fii.foo.com]
#       address foo
#
## Then our other Host...
# [fay.foo.com]
#       address fay
#
## Then we want totals...
# [foo.com;Totals] #Force it into the "foo.com"-domain...
#       update no   # Turn off data-fetching for this "Host".
#
#   # The graph "load1". We want to see the loads of both machines...
#   # "fii=fii.foo.com:load.load" means "label=machine:graph.field"
#       load1.graph_title Loads side by side
#       load1.graph_order fii=fii.foo.com:load.load fay=fay.foo.com:load.load
#
#   # The graph "load2". Now we want them stacked on top of each other.
#       load2.graph_title Loads on top of each other
#       load2.dummy_field.stack fii=fii.foo.com:load.load fay=fay.foo.com:load.load
#       load2.dummy_field.draw AREA # We want area instead the default LINE2.
#       load2.dummy_field.label dummy # This is needed. Silly, really.
#
#   # The graph "load3". Now we want them summarised into one field
#       load3.graph_title Loads summarised
#       load3.combined_loads.sum fii.foo.com:load.load fay.foo.com:load.load
#       load3.combined_loads.label Combined loads # Must be set, as this is
#                                                 # not a dummy field!
#
## ...and on a side note, I want them listen in another order (default is
## alphabetically)
#
# # Since [foo.com] would be interpreted as a Host in the domain "com", we
# # specify that this is a domain by adding a semicolon.
# [foo.com;]
#       node_order Totals fii.foo.com fay.foo.com
#

/etc/munin-node.conf

#
# Example config-file for munin-node
#

log_level 4
log_file /var/log/munin/munin-node.log
pid_file /var/run/munin/munin-node.pid

background 1
setsid 1

user root
group root

# Regexps for files to ignore

ignore_file ~$
#ignore_file [#~]$  # FIX doesn't work. '#' starts a comment
ignore_file DEADJOE$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$

ignore_file \.pod$

# Set this if the client doesn't report the correct hostname when
# telnetting to localhost, port 4949
#
#Host_name localhost.localdomain

# A list of addresses that are allowed to connect.  This must be a
# regular expression, since Net::Server does not understand CIDR-style
# network notation unless the Perl module Net::CIDR is installed.  You
# may repeat the allow line as many times as you'd like

allow ^127\.0\.0\.1$

allow ^123\.45\.67\.89$  #the external ip of my server

# If you have installed the Net::CIDR Perl module, you can use one or more
# cidr_allow and cidr_deny address/mask patterns.  A connecting client must
# match any cidr_allow, and not match any cidr_deny.  Note that a netmask
# *must* be provided, even if it's /32
#
# Example:
#
# cidr_allow 127.0.0.1/32
# cidr_allow 192.0.2.0/24
# cidr_deny  192.0.2.42/32

# Which address to bind to;
#Host *
 Host 127.0.0.1

# And which port
port 4949

/ etc/hosts

127.0.0.1       localhost
127.0.1.1       ubuntu
123.45.67.89  nemo.mysite.com  nemo
123.45.67.89  nemo.stats.mysite.com

編集

出力Sudo Apache2ctl -S

[Fri May 03 11:46:39 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server stats.mysite.com (/etc/Apache2/sites-enabled/stats.mysite.com:3)
         port 80 namevhost stats.mysite.com (/etc/Apache2/sites-enabled/stats.mysite.com:3)
         port 80 namevhost www.mysite.com (/etc/Apache2/sites-enabled/mysite.com:4)

Stats.mysite.comconfファイルからNameVirtualHost *:80を削除した後:

VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server stats.mysite.com (/etc/Apache2/sites-enabled/stats.mysite.com:1)
         port 80 namevhost stats.mysite.com (/etc/Apache2/sites-enabled/stats.mysite.com:1)
         port 80 namevhost www.mysite.com (/etc/Apache2/sites-enabled/mysite.com:4)
Syntax OK
3
Doon

Apache2ctl -Sの出力の[WARN]を見て、stats.mysite.comの構成ファイルを見ると、NameVirtualHost *:80が複数回あると推測されます。これが原因である可能性があります。問題。

Stats.mysite.comconfファイルおよびその他のサイト固有のファイルからNameVirtualHost *:80を削除し、/ etc/Apache2のメインのApache2.confファイルの終わり近くに1回だけ配置します。

1
Safado