39
38

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

新しいmacにbrewを使ってnginxをインストールする

Last updated at Posted at 2017-06-08

macを新調したので、webの環境を整えた時のメモ。
macのバージョンは macOS Sierra バージョン 10.12.3。

nginx

brewでnginxをインストール

curlで起動確認しています。localhostに接続すると接続できませんでした。
curl: (52) Empty reply from server

$ brew install nginx

$ nginx -v
nginx version: nginx/1.12.0

$ sudo nginx

$ curl http://127.0.0.1:8080/

参考
http://qiita.com/you-me/items/5548424ebe360e5f9dda

nginxの起動ポートを8080から80番に変更

sudoして実行しないと80番ポートから起動できませんでした。
nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)

/usr/local/etc/nginx/nginx.conf
    server {
        listen       80;
        server_name  localhost;
$ sudo nginx -s reload

$ curl http://127.0.0.1/

$ ls -l /usr/local/var/www

nginxの停止

macでnginxはずっと起動し続けないので停止します

$ sudo nginx -s stop

参考
http://qiita.com/sygnas/items/34c4c408bf3418b918a7

以上

39
38
1

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
39
38

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?