質問: 更新後にapache vhostsが機能しなくなる サーバーで複数のwebサイトを実行しています。たとえば、そのうちの1つは/var/www/mysite.com/。ubuntu 12.04 webサーバーのapache2をバージョン2.4にアップグレードし、インストールがports.confおよびapache2.confので、欠落していた構成アイテムを追加しましたが、今ではhttp://mysite.com、私が得るのは、/var/www。私は何が欠けていますか?重要:ポート80でリバースプロキシとしてnginxを使用しているため、ポート8080を使用しています。その部分は正常に機能しています。ports.conf# if you just change the port or add more ports here, you will likely also # have to change the virtualhost statement in # /etc/apache2/sites-enabled/000-default.conf listen 8080 <ifmodule ssl_module> listen 443 </ifmodule> <ifmodule mod_gnutls.c> listen 443 </ifmodule> apache2.conf# this is the main apache server configuration file. it contains the # configuration directives that give the server its instructions. # see http://httpd.apache.org/docs/2.4/ for detailed information about # the directives and /usr/share/doc/apache2/readme.debian about debian specific # hints. # # # summary of how the apache 2 configuration works in debian: # the apache 2 web server configuration in debian is quite different to # upstream's suggested way to configure the web server. this is because debian's # default apache2 installation attempts to make adding and removing modules, # virtual hosts, and extra configuration directives as flexible as possible, in # order to make automating the changes and administering the server as easy as # possible. # it is split into several files forming the configuration hierarchy outlined # below, all located in the /etc/apache2/ directory: # # /etc/apache2/ # |-- apache2.conf # | `-- ports.conf # |-- mods-enabled # | |-- *.load # | `-- *.conf # |-- conf-enabled # | `-- *.conf # `-- sites-enabled # `-- *.conf # # # * apache2.conf is the main configuration file (this file). it puts the pieces # together by including all remaining configuration files when starting up the # web server. # # * ports.conf is always included from the main configuration file. it is # supposed to determine listening ports for incoming connections which can be # customized anytime. # # * configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/ # directories contain particular configuration snippets which manage modules, # global configuration fragments, or virtual host configurations, # respectively. # # they are activated by symlinking available configuration files from their # respective *-available/ counterparts. these should be managed by using our # helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. see # their respective man pages for detailed information. # # * the binary is called apache2. due to the use of environment variables, in # the default configuration, apache2 needs to be started/stopped with # /etc/init.d/apache2 or apache2ctl. calling /usr/bin/apache2 directly will not # work with the default configuration. # global configuration # # # serverroot: the top of the directory tree under which the server's # configuration, error, and log files are kept. # # note! if you intend to place this on an nfs (or otherwise network) # mounted filesystem then please read the mutex documentation (available # at <url:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>); # you will save yourself a lot of trouble. # # do not add a slash at the end of the directory path. # #serverroot "/etc/apache2" # # the accept serialization lock file must be stored on a local disk. # mutex file:${apache_lock_dir} default # # pidfile: the file in which the server should record its process # identification number when it starts. # this needs to be set in /etc/apache2/envvars # pidfile ${apache_pid_file} # # timeout: the number of seconds before receives and sends time out. # timeout 300 # # keepalive: whether or not to allow persistent connections (more than # one request per connection). set to "off" to deactivate. # keepalive on # # maxkeepaliverequests: the maximum number of requests to allow # during a persistent connection. set to 0 to allow an unlimited amount. # we recommend you leave this number high, for maximum performance. # maxkeepaliverequests 100 # # keepalivetimeout: number of seconds to wait for the next request from the # same client on the same connection. # keepalivetimeout 5 # these need to be set in /etc/apache2/envvars user ${apache_run_user} group ${apache_run_group} # # hostnamelookups: log the names of clients or just their ip addresses # e.g., www.apache.org (on) or 204.62.129.132 (off). # the default is off because it'd be overall better for the net if people # had to knowingly turn this feature on, since enabling it means that # each client request will result in at least one lookup request to the # nameserver. # hostnamelookups off # errorlog: the location of the error log file. # if you do not specify an errorlog directive within a <virtualhost> # container, error messages relating to that virtual host will be # logged here. if you *do* define an error logfile for a <virtualhost> # container, that host's errors will be logged there and not here. # errorlog ${apache_log_dir}/error.log # # loglevel: control the severity of messages logged to the error_log. # available values: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # it is also possible to configure the log level for particular modules, e.g. # "loglevel info ssl:warn" # loglevel warn # include module configuration: includeoptional mods-enabled/*.load includeoptional mods-enabled/*.conf # include list of ports to listen on include ports.conf # sets the default security model of the apache2 httpd server. it does # not allow access to the root filesystem outside of /usr/share and /var/www. # the former is used by web applications packaged in debian, # the latter may be used for local directories served by the web server. if # your system is serving content from a sub-directory in /srv you must allow # access here, or in any related virtual host. <directory /> options followsymlinks allowoverride none require all denied </directory> <directory /usr/share> allowoverride none require all granted </directory> <directory /var/www/> options indexes followsymlinks allowoverride none require all granted </directory> #<directory /srv/> # options indexes followsymlinks # allowoverride none # require all granted #</directory> # accessfilename: the name of the file to look for in each directory # for additional configuration directives. see also the allowoverride # directive. # accessfilename .htaccess # # the following lines prevent .htaccess and .htpasswd files from being # viewed by web clients. # <filesmatch "^\.ht"> require all denied </filesmatch> # # the following directives define some format nicknames for use with # a customlog directive. # # these deviate from the common log format definitions in that they use %o # (the actual bytes sent including headers) instead of %b (the size of the # requested file), because the latter makes it impossible to detect partial # requests. # # note that the use of %{x-forwarded-for}i instead of %h is not recommended. # use mod_remoteip instead. # logformat "%v:%p %h %l %u %t \"%r\" %>s %o \"%{referer}i\" \"%{user-agent}i\"" vhost_combined logformat "%h %l %u %t \"%r\" %>s %o \"%{referer}i\" \"%{user-agent}i\"" combined logformat "%h %l %u %t \"%r\" %>s %o" common logformat "%{referer}i -> %u" referer logformat "%{user-agent}i" agent # include of directories ignores editors' and dpkg's backup files, # see readme.debian for details. # include generic snippets of statements includeoptional conf-enabled/*.conf # include the virtual host configurations: includeoptional sites-enabled/*.conf servername localhost # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 私の仮想ホスト<virtualhost 127.0.0.1:8080> servername mysite.com serveralias www.mysite.com documentroot /var/www/mysite.com # begin wordpress <directory /var/www/mysite.com/> <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> </directory> # end wordpress </virtualhost>
回答: 同様の問題がありました。apache debのメンテナンス担当者はapache2.confを修正しました:include /etc/apache2/sites-enabled/-> includeoptional sites-enabled/*.confしたがって、sites-enabled内のファイルに.conf拡張子が付いていない場合、そのファイルは読み取られないため無効になり、エラーは表示されません。