root@sakura:~# apt-get install apache2 パッケージリストを読み込んでいます... 完了 依存関係ツリーを作成しています 状態情報を読み取っています... 完了 以下の追加パッケージがインストールされます: apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 提案パッケージ: www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom 推奨パッケージ: ssl-cert 以下のパッケージが新たにインストールされます: apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 アップグレード: 0 個、新規インストール: 9 個、削除: 0 個、保留: 0 個。 2,123 kB のアーカイブを取得する必要があります。 この操作後に追加で 7,073 kB のディスク容量が消費されます。 続行しますか? [Y/n] y 取得:1 http://ftp.jp.debian.org/debian stretch/main amd64 libapr1 amd64 1.5.2-5 [96.6 kB] : : 取得:9 http://ftp.jp.debian.org/debian stretch/main amd64 apache2 amd64 2.4.25-3+deb9u3 [235 kB] 2,123 kB を 0秒 で取得しました (2,355 kB/s) 以前に未選択のパッケージ libapr1:amd64 を選択しています。 (データベースを読み込んでいます ... 現在 35740 個のファイルとディレクトリがインストールされて います。) .../0-libapr1_1.5.2-5_amd64.deb を展開する準備をしています ... : : apache2-bin (2.4.25-3+deb9u3) を設定しています ... apache2 (2.4.25-3+deb9u3) を設定しています ... Enabling module mpm_event. : : Enabling site 000-default. Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service → /lib/systemd/system/apache2.service. Created symlink /etc/systemd/system/multi-user.target.wants/apache-htcacheclean.service → /lib/systemd/system/apache-htcacheclean.service. libc-bin (2.24-11+deb9u1) のトリガを処理しています ... systemd (232-25+deb9u1) のトリガを処理しています ... root@sakura:~#
root@sakura:~# mkdir /home/httpd root@sakura:~# ln -s /var/www/html /home/httpd root@sakura:~# ln -s /usr/lib/cgi-bin/ /home/httpd root@sakura:~# ls -l /home/httpd/ 合計 0 lrwxrwxrwx 1 root root 17 2月 16 19:22 cgi-bin -> /usr/lib/cgi-bin/ lrwxrwxrwx 1 root root 13 2月 16 19:21 html -> /var/www/html root@sakura:~#
root@sakura:~# iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT root@sakura:~# iptables -L Chain INPUT (policy DROP) target prot opt source destination ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED DROP tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,PSH,ACK,URG/NONE DROP tcp -- anywhere anywhere tcp flags:!FIN,SYN,RST,ACK/SYN state NEW DROP tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,PSH,ACK,URG/FIN,SYN,RST,PSH,ACK,URG ACCEPT all -- anywhere anywhere ACCEPT icmp -- anywhere anywhere ACCEPT tcp -- anywhere anywhere tcp dpt:内緒 ACCEPT tcp -- anywhere anywhere tcp dpt:domain ACCEPT udp -- anywhere anywhere udp dpt:domain ACCEPT tcp -- anywhere anywhere tcp dpt:smtp ACCEPT tcp -- anywhere anywhere tcp dpt:http Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination root@sakura:~# /etc/init.d/netfilter-persistent save [....] Saving netfilter rules...run-parts: executing /usr/share/netfilter-persistent/plugins.d/15-ip4tables save run-parts: executing /usr/share/netfilter-persistent/plugins.d/25-ip6tables save done. root@sakura:~#
画像略
It Works!
root@sakura:~# chgrp www-data /usr/lib/cgi-bin /var/www/html root@sakura:~# chmod g+ws /usr/lib/cgi-bin/ /var/www/html/ root@sakura:~# ls -ld /usr/lib/cgi-bin/ /var/www/html/ drwxrwsr-x 2 root www-data 4096 9月 20 03:58 /usr/lib/cgi-bin/ drwxrwsr-x 2 root www-data 4096 2月 16 13:20 /var/www/html/ root@sakura:~# addgroup yasunari www-data ユーザ `yasunari' をグループ `www-data' に追加しています... ユーザ yasunari をグループ www-data に追加 完了。 root@sakura:~# rm /var/www/html/index.html root@sakura:~#
root@sakura:~# df ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置 udev 499064 0 499064 0% /dev tmpfs 102036 9336 92700 10% /run /dev/vda1 101655544 1323744 95124968 2% / tmpfs 510168 0 510168 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 510168 0 510168 0% /sys/fs/cgroup tmpfs 102032 0 102032 0% /run/user/1000 root@sakura:~#自宅サーバからまるごとコピーする
yasunari@xhl:/home/httpd$ rsync -rtuvpogtlH --timeout=360 -e "ssh -p 内緒 -i /home/yamasita/yasunari/.ssh/sakura_id_rsa" cgi-bin sakura.yamasita.jp:/usr/lib sending incremental file list rsync: failed to set times on "/usr/lib/cgi-bin": Operation not permitted (1) cgi-bin/ : : yasunari@xhl:/home/httpd$ rsync -rtuvpogtlH --timeout=360 -e "ssh -p 内緒 -i /home/yamasita/yasunari/.ssh/sakura_id_rsa" html sakura.yamasita.jp:/var/www sending incremental file list rsync: failed to set times on "/var/www/html": Operation not permitted (1) html/ html/.htaccess : :コピー後のディスク使用量
root@sakura:~# df ファイルシス 1K-ブロック 使用 使用可 使用% マウント位置 udev 499064 0 499064 0% /dev tmpfs 102036 9336 92700 10% /run /dev/vda1 101655544 15641564 80807148 17% / tmpfs 510168 0 510168 0% /dev/shm tmpfs 5120 0 5120 0% /run/lock tmpfs 510168 0 510168 0% /sys/fs/cgroup tmpfs 102032 0 102032 0% /run/user/1000 root@sakura:~#Web サーバ分だけでも 13GB とちょっと。。。
見慣れた景色 too
DNS への登録は後ほど。
← メールサーバの構築 |
山下康成の 雲の上 |
→ Web サーバの構築(2)Movable Type のインストール |
ツイート Tweet to @yasunari_y @yasunari_yをフォロー
Copyright (C) 2003-2018 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市/東京都新宿区