LoginSignup
21
18

More than 5 years have passed since last update.

Macでnginxを使う

Posted at

まずは使ってみる

基本は

brew install nginx

でインストールしたら

nginx

で起動して

を開けばいいだけ。

設定は

/usr/local/etc/nginx/nginx.conf

においてあり、ここを変えて変更する。

  • ストップ: nginx -s stop
  • リロード: nginx -s reload

のようにできるので、設定を変えたらリロードを忘れないこと。

localhost:8080のルートは、デフォルトで

/usr/local/www

に設定されており、このディレクトリ下のindex.htmlを書き換えれば内容が変わる。

モジュールをいろいろ使いたいとき

marcqualie/nginxに管理されているnginx-fullを使うのが良いらしい。

ちなみにnginxはモジュールとか言いつつ毎回ビルドし直さないといけないから、インストール時に何を入れるか指定しないといけない。なのでbrew nginx-fullで一から入れ直すという方法が簡単。

brew options marcqualie/nginx/nginx-full

とすれば、インストールできるモジュール一覧が確認できる。

とりあえず、image-filterと、使えるという噂のLua モジュールを入れてみる。

brew install marcqualie/nginx/nginx-full --with-lua-module --with-image-filter

--with-image-filterはGD Libraryが必要なので、brew install libgdをした後にやらないとダメなので注意。

brew install nginxをしちゃってる人は、brew uninstall nginxをしてからやったほうが無難。まぁbrew link nginx-fullとか使えば後からでもなんとかなる。

21
18
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
21
18