Over a million developers have joined DZone.

Compile & Install Nginx Web Server

·
Requirement on Mac OS X: Xcode


# See:
# - http://en.wikipedia.org/wiki/Nginx
# - http://wiki.codemongers.com/NginxGettingStarted
# - http://wiki.codemongers.com/NginxInstallOptions
# - http://wiki.codemongers.com/NginxCommandLine
# - http://wiki.codemongers.com/NginxConfiguration

export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin"

mkdir -p ~/Desktop/Nginx
cd ~/Desktop/Nginx

curl -L -O http://sysoev.ru/nginx/nginx-0.7.2.tar.gz
tar -xzf nginx-0.7.2.tar.gz

curl -L -O http://downloads.sourceforge.net/pcre/pcre-7.7.tar.gz
tar -xzf pcre-7.7.tar.gz

cd ~/Desktop/Nginx/nginx-0.7.2
./configure --help
./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin --with-debug --with-http_ssl_module --with-pcre=../pcre-7.7
make
sudo make install


which nginx
otool -L /usr/local/sbin/nginx
open /usr/local/nginx
open -e /usr/local/nginx/conf/nginx.conf

nginx -v
nginx -V
sudo nginx   # start server
sudo nginx -t

open http://localhost:80
open http://localhost:80/50x.html

sudo nano /usr/local/nginx/conf/nginx.conf   # editing ... server {  listen  8080; ... 

# reload configuration
sudo kill -HUP `cat /usr/local/nginx/logs/nginx.pid`  

# stop server
sudo kill -15 $(ps -auxxx | egrep "[n]ginx.*master" | awk '{ print $2 }') 2>/dev/null
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}