DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Compile & Install Nginx Web Server

  • submit to reddit
        Requirement on Mac OS X: <a href="">Xcode</a>

# See:
# -
# -
# -
# -
# -

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

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

curl -L -O
tar -xzf nginx-0.7.2.tar.gz

curl -L -O
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
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/`  

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