How to Configure and Install Nginx on Mac OS X
In this tutorial, I would like to show how to configure and install nginx on Mac OS X. My Mac system is Mavericks 10.9.2.
Prerequisites
You have to install Xcode command line tools.
Install Nginx
-
Download the latest stable version – nginx 1.4.7.
-
Unzip the downloaded package by the command “tar xvzf nginx-1.4.7.tar.gz”.
-
“cd nginx-1.4.7”.
-
“sudo ./configure”. There is an error displayed:
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
-
To fix the error, visit the tutorial page and read “Building nginx from Sources”, in which you can find the link of PCRE library.
-
Go to PCRE official site, and find the latest version of PCRE library on SourceForge.
-
Download the package and unzip it by the command “tar xvzf pcre-8.34.tar.bz2”.
-
Now, you can run the configure file again with the parameters ”sudo ./configure –with-pcre=path”.
-
Configuration is done.
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
the default nginx path prefix is “/usr/local/nginx”.
-
To install nginx, type in “sudo make install”.
-
Find the executable file “cd /usr/local/nginx/sbin”
-
Launch nginx “sudo ./nginx”
The nginx is successfully running now!
If you have any questions, just email {desmond at dynamsoft dot com}.