前回、NginxとGoをそれぞれインストールした。
thoames.hatenadiary.jp
thoames.hatenadiary.jp
ここでは以下の前提で設定する。
Goは「127.0.0.1:5050」で既に動作しているという前提で
話をすすめる。
$ ./app &
nginxの設定を以下のようにすれば動作する。
設定
default.conf
server { listen 80; server_name localhost; location / { proxy_pass http://127.0.0.1:5050; } }
GoでFastCGIを使用するため
"net/http/fcgi"パッケージを使用する場合は、
以下のように設定できるっぽい。
server { listen 80; server_name localhost; location / { fastcgi_pass 127.0.0.1:5050; include fastcgi_params; } }
再起動
$ sudo service nginx restart