ブログ - nginxのエラーログに[emerg] : bind() to 0.0.0.0:80 failed (13: Permission denied)とでちゃう
nginxのエラーログに[emerg] : bind() to 0.0.0.0:80 failed (13: Permission denied)とでちゃう
- カテゴリ :
- Apple » MacBook Pro » 2011 13inch
- ブロガー :
- ujpblog 2017/11/29 1:32
Home Brewでインストールしたnginxは,8080ポートでリッスンしているが,80番に変更する.イメージ的にはこんな感じ.

編集するのは,このファイル.
みて分かる通り,次のように変更,.
そしてnginxを停止して起動.
http://localhost:80
アクセスできない.エラーログを確認.
これをみると・・・
これは,80番ポートを割り当て(bind)起動しようとしたが権限が無いのでエラーとなっている.sudoで起動してみる.
再度,これをアクセス.
http://localhost:80
問題なし.

編集するのは,このファイル.
/usr/local/etc/nginx/nginx.conf
server {
# listen 8080;
listen 80;
server_name localhost;
gaia:nginx server$ brew services stop nginx
Stopping `nginx`... (might take a while)
==> Successfully stopped `nginx` (label: homebrew.mxcl.nginx)
gaia:nginx server$ brew services start nginx
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
gaia:nginx server$
http://localhost:80
アクセスできない.エラーログを確認.
tail -f /usr/local/Cellar/nginx/1.12.2_1/logs/error.log
2017/11/29 01:22:05 [emerg] 19863#0: bind() to 0.0.0.0:80 failed (13: Permission denied)
2017/11/29 01:22:05 [emerg] 19863#0: bind() to 0.0.0.0:80 failed (13: Permission denied)
2017/11/29 01:22:05 [emerg] 19863#0: bind() to 0.0.0.0:80 failed (13: Permission denied)
gaia:nginx server$ sudo brew services start nginx
Password:
==> Successfully started `nginx` (label: homebrew.mxcl.nginx)
gaia:nginx server$
http://localhost:80
問題なし.