前回の更新から3年が経ちました。これが私が2021年にmacOSでそれを動作させた方法です(マリオの答えの拡張として):
# Install stunnel
brew install stunnel
# Find the configuration directory
cd /usr/local/etc/stunnel
# Copy the sample conf file to actual conf file
cp stunnel.conf-sample stunnel.conf
# Edit conf
vim stunnel.conf
次のように変更stunnel.conf
します:(他のすべてのオプションは削除できます)
; **************************************************************************
; * Global options *
; **************************************************************************
; Debugging stuff (may be useful for troubleshooting)
; Enable foreground = yes to make stunnel work with Homebrew services
foreground = yes
debug = info
output = /usr/local/var/log/stunnel.log
; **************************************************************************
; * Service definitions (remove all services for inetd mode) *
; **************************************************************************
; ***************************************** Example TLS server mode services
; TLS front-end to a web server
[https]
accept = 443
connect = 8000
cert = /usr/local/etc/stunnel/stunnel.pem
; "TIMEOUTclose = 0" is a workaround for a design flaw in Microsoft SChannel
; Microsoft implementations do not use TLS close-notify alert and thus they
; are vulnerable to truncation attacks
;TIMEOUTclose = 0
これは、ポート443でHTTPS / SSLを受け入れ、stunnelのデフォルトの偽の証明書を使用してポート8000で実行されているローカルWebサーバーに接続します/usr/local/etc/stunnel/stunnel.pem
。ログレベルはでinfo
あり、ログ出力はに書き込まれ/usr/local/var/log/stunnel.log
ます。
stunnelを開始します:
brew services start stunnel # Different for Linux
Webサーバーを起動します。
php -S localhost:8000
https://localhost:443
これで、Webサーバーにアクセスできます:スクリーンショット
証明書エラーが発生するはずであり、ブラウザの警告をクリックする必要がありますが、開発のために、HTTPSリクエストでローカルホストにアクセスできるようになります。