2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

備忘録 Apacheのポートを変えたらつながらなくなったでござる。

Last updated at Posted at 2017-03-22

調子にのって、Apacheのポート番号を変えてみたらつながらなくなりました。。。。。

/etc/httpd/conf/httpd.confファイルを編集

80 portから 11080 portに変更

httpd.confの編集箇所
Listen 192.168.56.106:11080
ServerName 192.168.56.106:11080

ssコマンドでみると、11080がListenされているから、接続できる!と勘違いしがち。

# ss -nat
State      Recv-Q Send-Q              Local Address:Port                             Peer Address:Port
LISTEN     0      128                192.168.56.106:11080                                       *:*
LISTEN     0      128                             *:22                                          *:*
LISTEN     0      100                     127.0.0.1:25                                          *:*
ESTAB      0      0                  192.168.56.106:22                               192.168.56.1:50242
ESTAB      0      64                 192.168.56.106:22                               192.168.56.1:64639
LISTEN     0      128                            :::22                                         :::*
LISTEN     0      100                           ::1:25                                         :::*

firewalldコマンドで11080 portを許可する。

これが必要なのでした。。。。

なぜなら、

# firewall-cmd --list-all
public (default, active)
  interfaces: enp0s3 enp0s8
  sources:
  services: dhcpv6-client http ssh
  ports:     
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

許可されている http は 80 portとのこと(/etc/services参照)。

なので、11080 portでアクセスしたいのなら、このportを追加してやらねばなりませぬ。

備忘録 CentOS 7 firewalldでは、

--add-services=http

で httpを許可しましたが、今回は、

--add-port=ポート番号/プロトコル

で設定がいりました。

# firewall-cmd --permanent --add-port=11080/tcp
success

設定を反映。

# firewall-cmd --reload
success

Webブラウザでアクセス

アクセス成功!

2017032103.JPG

firewalldを OFF してしまえばいいのでしょうが、折角なので firewalldと仲良くなっていきたいと思います。

2
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?