Skip to content

Instantly share code, notes, and snippets.

@Meandmybadself
Last active December 31, 2020 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meandmybadself/26d8e9583eebbd53d93e5e680bed5b6a to your computer and use it in GitHub Desktop.
Save Meandmybadself/26d8e9583eebbd53d93e5e680bed5b6a to your computer and use it in GitHub Desktop.
Compile nginx on Mac OS X 10.9.5
# Run as su
# Kill Apache.
sudo apachectl -k stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
curl -OL http://nginx.org/download/nginx-1.14.0.tar.gz
tar -xvzf nginx-1.14.0.tar.gz
# PCRE for doing regex in nginx
curl -OL https://ftp.pcre.org/pub/pcre/pcre-8.41.tar.gz
tar xvzf pcre-8.41.tar.gz && rm pcre-8.41.tar.gz
# jdomain, for doing internal domain lookups.
curl -OL https://github.com/wdaike/ngx_upstream_jdomain/archive/master.zip
unzip master.zip
curl -OL https://www.openssl.org/source/openssl-1.1.0g.tar.gz
tar xvzf openssl-1.1.0g.tar.gz && rm openssl-1.1.0g.tar.gz
cd nginx-1.14.0/
./configure --with-http_v2_module --with-http_auth_request_module --with-http_gzip_static_module --with-pcre=../pcre-8.41/ --add-module=/usr/local/src/ngx_upstream_jdomain-master --with-http_ssl_module --with-openssl=/usr/local/src/openssl-1.1.0g
make && make install
cd /usr/local/nginx/
mkdir sites-available
mkdir sites-enabled
# Edit nginx.conf to add before ending server }
include /usr/local/nginx/conf/sites-enabled/*;
echo 'export PATH="/usr/local/nginx/sbin:$PATH"' >> ~/.profile
<!-- After writing, run `launchctl load -F /System/Library/LaunchDaemons/nginx.plist` //-->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>nginx</string>
<key>Program</key><string>/usr/local/nginx/sbin/nginx</string>
<key>KeepAlive</key><true/>
<key>NetworkState</key><true/>
<key>StandardErrorPath</key><string>/var/log/system.log</string>
<key>LaunchOnlyOnce</key><true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment