Apacheのインストール
# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3
libaprutil1-ldap
Suggested packages:
www-browser apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-bin apache2.2-common libapr1 libaprutil1
libaprutil1-dbd-sqlite3 libaprutil1-ldap
0 upgraded, 9 newly installed, 0 to remove and 4 not upgraded.
Need to get 1461 kB of archives.
After this operation, 5599 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://http.debian.net/debian/ wheezy/main libapr1 amd64 1.4.6-3 [99.6 kB]
Get:2 http://http.debian.net/debian/ wheezy/main libaprutil1 amd64 1.4.1-3 [89.8 kB]
Get:3 http://http.debian.net/debian/ wheezy/main libaprutil1-dbd-sqlite3 amd64 1.4.1-3 [19.0 kB]
Get:4 http://http.debian.net/debian/ wheezy/main libaprutil1-ldap amd64 1.4.1-3 [16.6 kB]
Get:5 http://http.debian.net/debian/ wheezy/main apache2.2-bin amd64 2.2.22-13 [779 kB]
Get:6 http://http.debian.net/debian/ wheezy/main apache2-utils amd64 2.2.22-13 [162 kB]
Get:7 http://http.debian.net/debian/ wheezy/main apache2.2-common amd64 2.2.22-13 [291 kB]
Get:8 http://http.debian.net/debian/ wheezy/main apache2-mpm-worker amd64 2.2.22-13 [2256 B]
Get:9 http://http.debian.net/debian/ wheezy/main apache2 amd64 2.2.22-13 [1432 B]
Fetched 1461 kB in 5s (245 kB/s)
Selecting previously unselected package libapr1.
(Reading database ... 22167 files and directories currently installed.)
Unpacking libapr1 (from .../libapr1_1.4.6-3_amd64.deb) ...
Selecting previously unselected package libaprutil1.
Unpacking libaprutil1 (from .../libaprutil1_1.4.1-3_amd64.deb) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3.
Unpacking libaprutil1-dbd-sqlite3 (from .../libaprutil1-dbd-sqlite3_1.4.1-3_amd64.deb) ...
Selecting previously unselected package libaprutil1-ldap.
Unpacking libaprutil1-ldap (from .../libaprutil1-ldap_1.4.1-3_amd64.deb) ...
Selecting previously unselected package apache2.2-bin.
Unpacking apache2.2-bin (from .../apache2.2-bin_2.2.22-13_amd64.deb) ...
Selecting previously unselected package apache2-utils.
Unpacking apache2-utils (from .../apache2-utils_2.2.22-13_amd64.deb) ...
Selecting previously unselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.22-13_amd64.deb) ...
Selecting previously unselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.22-13_amd64.deb) ...
Selecting previously unselected package apache2.
Unpacking apache2 (from .../apache2_2.2.22-13_amd64.deb) ...
Processing triggers for man-db ...
Setting up libapr1 (1.4.6-3) ...
Setting up libaprutil1 (1.4.1-3) ...
Setting up libaprutil1-dbd-sqlite3 (1.4.1-3) ...
Setting up libaprutil1-ldap (1.4.1-3) ...
Setting up apache2.2-bin (2.2.22-13) ...
Setting up apache2-utils (2.2.22-13) ...
Setting up apache2.2-common (2.2.22-13) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.
Enabling module reqtimeout.
Setting up apache2-mpm-worker (2.2.22-13) ...
[ ok ] Starting web server: apache2.
Setting up apache2 (2.2.22-13) ...
PHP5のインストール
# apt-get install php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 libonig2 libqdbm14 php5-cli php5-common psmisc
Suggested packages:
php-pear
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 libonig2 libqdbm14 php5 php5-cli php5-common psmisc
0 upgraded, 8 newly installed, 1 to remove and 4 not upgraded.
Need to get 6246 kB of archives.
After this operation, 19.4 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://http.debian.net/debian/ wheezy/main apache2-mpm-prefork amd64 2.2.22-13 [2360 B]
Get:2 http://security.debian.org/ wheezy/updates/main php5-common amd64 5.4.4-14+deb7u4 [587 kB]
Get:3 http://http.debian.net/debian/ wheezy/main psmisc amd64 22.19-1+deb7u1 [135 kB]
Get:4 http://http.debian.net/debian/ wheezy/main libonig2 amd64 5.9.1-1 [145 kB]
Get:5 http://security.debian.org/ wheezy/updates/main libapache2-mod-php5 amd64 5.4.4-14+deb7u4 [2665 kB]
Get:6 http://http.debian.net/debian/ wheezy/main libqdbm14 amd64 1.8.78-2 [153 kB]
Get:7 http://security.debian.org/ wheezy/updates/main php5 all 5.4.4-14+deb7u4 [1026 B]
Get:8 http://security.debian.org/ wheezy/updates/main php5-cli amd64 5.4.4-14+deb7u4 [2557 kB]
Fetched 6246 kB in 10s (616 kB/s)
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you requested:
apache2 depends on apache2-mpm-worker (= 2.2.22-13) | apache2-mpm-prefork (= 2.2.22-13) | apache2-mpm-event (= 2.2.22-13) | apache2-mpm-itk (= 2.2.22-13); however:
Package apache2-mpm-worker is to be removed.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
Package apache2-mpm-itk is not installed.
(Reading database ... 22750 files and directories currently installed.)
Removing apache2-mpm-worker ...
[ ok ] Stopping web server: apache2 ... waiting .
Selecting previously unselected package apache2-mpm-prefork.
(Reading database ... 22745 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.22-13_amd64.deb) ...
Setting up apache2-mpm-prefork (2.2.22-13) ...
[ ok ] Starting web server: apache2.
Selecting previously unselected package psmisc.
(Reading database ... 22750 files and directories currently installed.)
Unpacking psmisc (from .../psmisc_22.19-1+deb7u1_amd64.deb) ...
Selecting previously unselected package php5-common.
Unpacking php5-common (from .../php5-common_5.4.4-14+deb7u4_amd64.deb) ...
Selecting previously unselected package libonig2.
Unpacking libonig2 (from .../libonig2_5.9.1-1_amd64.deb) ...
Selecting previously unselected package libqdbm14.
Unpacking libqdbm14 (from .../libqdbm14_1.8.78-2_amd64.deb) ...
Selecting previously unselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.4.4-14+deb7u4_amd64.deb) ...
Selecting previously unselected package php5.
Unpacking php5 (from .../php5_5.4.4-14+deb7u4_all.deb) ...
Selecting previously unselected package php5-cli.
Unpacking php5-cli (from .../php5-cli_5.4.4-14+deb7u4_amd64.deb) ...
Processing triggers for man-db ...
Setting up psmisc (22.19-1+deb7u1) ...
Setting up php5-common (5.4.4-14+deb7u4) ...
Creating config file /etc/php5/mods-available/pdo.ini with new version
Setting up libonig2 (5.9.1-1) ...
Setting up libqdbm14 (1.8.78-2) ...
Setting up libapache2-mod-php5 (5.4.4-14+deb7u4) ...
Creating config file /etc/php5/apache2/php.ini with new version
[ ok ] Restarting web server: apache2 ... waiting .
Setting up php5 (5.4.4-14+deb7u4) ...
Setting up php5-cli (5.4.4-14+deb7u4) ...
Creating config file /etc/php5/cli/php.ini with new version
update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode
バーチャルホストの設定
# cd /etc/apache2/sites-enabled
# nano 000-default
<VirtualHost *:80>
ServerAdmin webmaster@sitename.jp
DocumentRoot /var/www/vhosts/www.sitename.jp
ServerName www.sitename.jp
ServerAlias localhost
<Directory />
Options FollowSymLinks
AllowOverride FileInfo
</Directory>
# <Directory /var/www/html>
# Options 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
ErrorLog /var/log/apache2/www.sitename.jp-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
# CustomLog ${APACHE_LOG_DIR}/access.log combined
CustomLog /var/log/apache2/www.sitename.jp-access.log combined
</VirtualHost>
バーチャルホストのディレクトリを作成する
# cd /var/www
# mkdir vhosts
# cd vhosts
# mkdir www.sitesname.jp
# cd ..
# chown -R daemon:daemon vhosts
# chmod 755 -R vhosts
Apacheの再起動
# /etc/init.d/apache2 restart