
新しい Ubuntu サーバーに新しい Apache をインストールしました。サーバーにはまだ変更を加えていません。デフォルトの Apache Web サイトは、プライベート ネットワーク内の他の PC から見ることができます。
ポート 80 と 22 はサーバーに適切に転送されており、ルーターから固定 IP DHCP 192.168.10.116 を設定しました。
SSH はパブリック ネットワークまたはプライベート ネットワークからアクセスできます。ただし、Web サイトはプライベート ネットワークからのみアクセスできます。Web サイトを世界中に公開したいと考えています。
なお、私はこのセットアップを Windows PC + XAMMP で試しましたが、デフォルトの Apache Web ページはパブリック IP から表示可能でした。
以下に詳細を記載します。
mg@node1:~$ sudo ufw status
Status: inactive
mg@node1:~$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
mg@node1:~$ cat /etc/apache2/ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
mg@node1:~$ sudo netstat -nptl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 702/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 780/sshd
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 1039/sshd: mg@pts/0
tcp6 0 0 :::80 :::* LISTEN 2340/apache2
tcp6 0 0 :::22 :::* LISTEN 780/sshd
tcp6 0 0 ::1:6010 :::* LISTEN 1039/sshd: mg@pts/0
mg@node1:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 node1
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
mg@node1:~$ curl http://192.168.10.116
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML ... ...
mg@node1:~$ curl http://43.xxx.xxx.95
curl: (7) Failed to connect to 43.xxx.xxx.95 port 80: Connection refused