LoginSignup
4
3

More than 5 years have passed since last update.

OSXのapacheをSSLリバースプロキシとして使う

Posted at

前提

OSX El Capitan

設定ファイルの準備

/etc/apache2/httpd.conf
# 89行目あたり(SSLを有効にするならこれが必要ぽい)
LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so

# 143行目あたり
LoadModule ssl_module libexec/apache2/mod_ssl.so

# 168行目あたり(SSL云々には関係ないが,http→httpsへリダクレクトさせたいため)
LoadModule rewrite_module libexec/apache2/mod_rewrite.so

# 516行目あたり
Include /private/etc/apache2/extra/httpd-ssl.conf
/etc/apache2/extra/httpd-mpm.conf
# 20行目あたり(SyntaxErrorだと怒られるのでコメントアウトする)
<IfModule !mpm_netware_module>
#LockFile "/private/var/log/apache2/accept.lock"
</IfModule>
/etc/apache2/extra/httpd-ssl.conf
# 68行目あたり(SyntaxErrorだと怒られるのでコメントアウトする)
#SSLMutex  "file:/private/var/run/ssl_mutex"

# 110行目以降あたり(鍵は適当に作成しておく)
SSLCertificateFile      "/private/etc/apache2/server.crt"
SSLCertificateKeyFile   "/private/etc/apache2/server.key"
SSLCertificateChainFile "/private/etc/apache2/server-ca.crt"

other以下に*.confという名前で設定ファイルを置くと勝手に読みこまれる.

/etc/apache2/other/dev.conf
SSLProxyEngine on

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

ProxyPass / https://test.foobar.com/
ProxyPassReverse / https://test.foobar.com/

apache再起動

sudo apachectl -k restart

あとはhttp://<<macのIP>>にアクセスすれば良い

4
3
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
4
3