Macにbrewでnginx入れようとしたら意外にハマった。。
homebrewで入れていたnginxをアンインストールして最新の入れようと思ったらすでにMacPortでインストールされてるのあるから無理っすって言われたのでMacPortの方もアンインストールして入れようとしたけどなんかハマったの巻。
» brew unlink nginx Unlinking /usr/local/Cellar/nginx/1.2.0... 0 links removed » brew install nginx Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. Error: You must `brew link pcre' before nginx can be installed » port uninstall nginx Warning: port definitions are more than two weeks old, consider using selfupdate Error: Insufficient privileges to write to MacPorts install prefix. » sudo port uninstall nginx Password: Warning: port definitions are more than two weeks old, consider using selfupdate ---> Deactivating nginx @1.2.0_1+ssl ---> Cleaning nginx ---> Uninstalling nginx @1.2.0_1+ssl ---> Cleaning nginx
一掃!
って思ったら
» brew install nginx Warning: It appears you have MacPorts or Fink installed. Software installed with other package managers causes known problems for Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again. Error: You must `brew link pcre' before nginx can be installed
げげ、またMacPortsの影あり。
ということでここを参考にMacPortsをアンインストールすることにした。
» sudo port -fp uninstall --follow-dependents installed Warning: port definitions are more than two weeks old, consider using selfupdate ---> Deactivating pcre @8.12_1 ---> Cleaning pcre ---> Uninstalling pcre @8.12_1 ---> Cleaning pcre ---> Deactivating bzip2 @1.0.6_0 ---> Cleaning bzip2 ---> Uninstalling bzip2 @1.0.6_0 ---> Cleaning bzip2 ---> Deactivating libedit @20110802-3.0_0 ---> Cleaning libedit---> Uninstalling libedit @20110802-3.0_0---> Cleaning libedit---> Deactivating ncurses @5.9_1---> Cleaning ncurses---> Uninstalling ncurses @5.9_1---> Cleaning ncurses---> Deactivating openssl @1.0.1a_0---> Cleaning openssl---> Uninstalling openssl @1.0.1a_0---> Cleaning openssl---> Deactivating zlib @1.2.6_0---> Cleaning zlib---> Uninstalling zlib @1.2.6_0---> Cleaning zlib » sudo rm -rf /opt/local /Applications/DarwinPorts /Applications/MacPorts /Library/LaunchDaemons/org.macports.* /Library/Receipts/DarwinPorts*.pkg /Library/Receipts/MacPorts*.pkg /Library/StartupItems/DarwinPortsStartup /Library/Tcl/darwinports1.0 /Library/Tcl/macports1.0 ~/.macports
いささか不安が残るがこれでいけるはず?
» brew install nginx Error: You must `brew link pcre' before nginx can be installed
pcreをlinkしてと?
» brew link --overwrite pcre Linking /usr/local/Cellar/pcre/8.32... Warning: Could not link pcre. Unlinking... Error: Permission denied - /usr/local/share/doc/pcre/README
無理やりやろうと思ったけどだめだったのでここにあるように権限を無理やりいじる。
» cd /usr/local » sudo chown -R $(whoami) /usr/local/share/doc/pcre » brew link --overwrite pcre Linking /usr/local/Cellar/pcre/8.32... 183 symlinks created
今度こそ!
» brew install nginx ==> Downloading http://nginx.org/download/nginx-1.2.7.tar.gz <後略>
キタ━(゚∀゚)━!
nginxを起動してみる。
sudo nginx curl http://localhost:8080/ <!DOCTYPE html> <html> <head> <title>Welcome to nginx!</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>Welcome to nginx!</h1> <p>If you see this page, the nginx web server is successfully installed and working. Further configuration is required.</p> <p>For online documentation and support please refer to <a href="http://nginx.org/">nginx.org</a>.<br/> Commercial support is available at <a href="http://nginx.com/">nginx.com</a>.</p> <p><em>Thank you for using nginx.</em></p> </body> </html>
OK!!!
自動起動はこれでいけてるはず。
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
意外にハマった・・・
追記[2013/04/18 19:53]
ちねみに設定ファイルはここだった。
/usr/local/etc/nginx/nginx.conf