LoginSignup
1
0

More than 5 years have passed since last update.

CentOS7にNginx(SSLアクセラレータ)+Apache(リバースプロキシ)を入れたら動かない

Last updated at Posted at 2019-01-25

自分用の備忘録です。多分お役に立てない。

作りたい環境

▼OS
CentOS7.6

▼ミドルウェア
Apache(リバースプロキシ)
Nginx(SSLアクセラレータ)

行った作業

  1. CentOS7インストールおよび初期設定
  2. yumアップデート
  3. Nginxインストール(80番ポートに自動設定)
  4. mod_sslインストール
  5. Nginx SSL設定(443番ポートに設定)
  6. Apacheインストール(8080番ポートに手動設定)
  7. 同時にphp、php-mbstringインストール
  8. Apache再起動(設定反映のため)

ここで問題発生

Apacheが再起動出来ず。

たちけて。

原因は?

journalctlで確認すると・・・

console
# journalctl -u httpd.service

 (98)Address already in use: AH00072: make_sock: could not bind to address [::]:443
 (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:443

Apacheの再起動時、自動的にhttpsの接続も実行され443番ポートへアクセスを試みていたため、先に443番ポートを使用しているNginxとぶつかってしまい再起動を実行出来なくなっていた。

そりゃそうだよね。

試した解決策

Apacheが443番ポートに接続しようとしてるのが原因なら、それを止めちゃえばいいんだよね。

console
# vi /etc/httpd/conf.d/ssl.conf
/etc/httpd/conf.d/ssl.conf
# When we also provide SSL we have to listen to the
# the HTTPS port in addition.
#
Listen 443 https
↓書き換え
Listen 444 https


##
## SSL Virtual Host Context
##

<VirtualHost _default_:443>
↓書き換え
<VirtualHost _default_:444>


# General setup for the virtual host, inherited from global configuration
DocumentRoot "/var/www/html"
#ServerName www.example.com:443
↓書き換え(コメントアウトしてるけど念のため)
#ServerName www.example.com:444

で、とりあえず動いた。
今のところ不具合は出ていないが、今後作業を進めて行った時どうなるか分からない。

細かいところは随時調べていく予定。

1
0
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
1
0