変更履歴
apacheをいつもソースからインストールしているしているため、パッケージシステムに則った作法を知らないので勉強する
sudo apt-get install apache2 apache2-mpm-prefork apache2-utils sudo apt-get install php5 libapache2-mod-php5
いきなりデーモン立ち上がるとかうざいよね
sudo /etc/init.d/apache2 stop sudo update-rc.d -f apache2 remove # init.dから削除
/usr/sbin/a2enmod /usr/sbin/a2dismod
apacheモジュールを有効/無効にするコマンド
/usr/sbin/a2ensite /usr/sbin/a2dissite
サイトを有効/無効にするコマンド
/usr/share/doc/apache2.2-common/README.Debian.gzから引用
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. Please be aware that this layout is quite different from the standard Apache configuration. Due to the use of environment variables, 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. Files and Directories in /etc/apache2: ------------------------------------- apache2.conf This is the main configuration file. envvars This contains environment variables that may be used in the configuration. Some settings, like user and pid file, need to go in here so that other scripts can use them. It can also be used to change some default settings used by apache2ctl. conf.d/ Files in this directory are included by this line in apache2.conf: # Include generic snippets of statements Include /etc/apache2/conf.d This is a good place to add additional configuration directives. httpd.conf Empty file. magic Empty file. mods-available/ This directory contains a series of .load and .conf files. The .load files contain the Apache configuration directive necessary to load the module in question. The respective .conf files contain configuration directives necessary to utilize the module in question. mods-enabled/ To actually enable a module for Apache2, it is necessary to create a symlink in this directory to the .load (and .conf, if it exists) files associated with the module in mods-available/. For example: cgi.load -> /etc/apache2/mods-available/cgi.load ports.conf Configuration directives for which ports and IP addresses to listen to. sites-available/ Like mods-available/, except it contains configuration directives for different virtual hosts that might be used with apache2. Note that the hostname doesn't have to correspond exactly with the filename. 'default' is the default host. sites-enabled/ Similar in functionality to mods-enabled/, sites-enabled contains symlinks to sites in sites-available/ that the admnistrator wishes to enable. Apache uses the first VirtualHost that matches the IP/Port as default for named virtual hosts. Therefore the 'default' site is linked to '000-default' so that it will be read first. Example: dedasys -> /etc/apache2/sites-available/dedasys The Include directive ignores files with names that - do not begin with a letter or number - contain a character that is neither letter nor number nor _-. - contain .dpkg Other files ----------- For historical reasons, the pid file is in /var/run/apache2.pid and not in /var/run/apache2/apache2.pid. Tools ----- a2enmod and a2dismod are available for enabling and disabling modules utilizing the above configuration system. a2ensite and a2dissite do essentially the same thing as the above tools, but for sites rather than modules.
/etc/init.d/apache2かapache2ctlを使う/etc/apache2/envvarsには、apacheの実行ユーザ/グループと、pidファイルパスを記述する/etc/apache2/mods-available、/etc/apache2/mods-enabledには、apacheモジュールのローダと設定ファイルが置かれる/etc/apache2/ports.confには、ListenするIPとポートを記述する/etc/apache2/sites-available、/etc/apache2/sites-enabledには、バーチャルホスト関係のファイルが置かれるhistorical reasons == 歴史的な理由
1) Error message "Could not determine the server's fully qualified domain name,
using 127.0.0.1 for ServerName" during start
This can usually be ignored but it means that Apache httpd was unable to obtain
a fully-qualified hostname by doing a reverse lookup on your server's IP
address. You may want to add the fully-qualified hostname to /etc/hosts .
2) Error message "mod_rewrite: could not create rewrite_log_lock"
This probably means that there are some stale SYSV semaphores around. This
usually happens after apache2 has been killed with kill -9 (SIGKILL). You can
clean up the semaphores with:
ipcs -s | grep www-data | awk ' { print $2 } ' | xargs ipcrm sem