-
-
Save sirodoht/e802d76b4132f390fe63650924511587 to your computer and use it in GitHub Desktop.
Building nginx for macOS without homebrew
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# default target so running 'make' by itself wll download and build nginx | |
build: nginx | |
cd nginx && ./configure --with-pcre=../pcre2 && make | |
nginx: pcre2 | |
curl -O https://nginx.org/download/nginx-1.21.6.tar.gz | |
tar -xzvf nginx-*.tar.gz | |
mv nginx-*/ nginx | |
rm nginx-*.tar.gz | |
pcre2: | |
curl -OL https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.gz | |
tar -xzvf pcre2-*.tar.gz | |
mv pcre2-*/ pcre2 | |
rm pcre2-*.tar.gz | |
# clean removes files used to build nginx to allow for a fresh build | |
clean: | |
rm -rf nginx* *.tar.gz pcre2* | |
# install requires elevated permissions and installs to the default /usr/local/nginx | |
install: build | |
cd nginx && sudo make install | |
# some handy symlinks | |
symlinks: | |
ln -s /usr/local/nginx/logs/access.log access.log | |
ln -s /usr/local/nginx/conf/nginx.conf nginx.conf | |
ln -s /usr/local/nginx/logs/error.log error.log | |
# purge will stop nginx and remove everything created when installing | |
purge: clean | |
rm -f *.log nginx.conf | |
sudo /usr/local/nginx/sbin/nginx -s quit | |
sudo rm -rf /usr/local/nginx | |
# backup makes a copy of nginx.conf | |
backup: | |
cp /usr/local/nginx/conf/nginx.conf backup.nginx.conf | |
# restore puts the backup of nginx.conf back into place | |
restore: | |
sudo cp backup.nginx.conf /usr/local/nginx/conf/nginx.conf | |
start: | |
sudo /usr/local/nginx/sbin/nginx | |
stop: | |
sudo /usr/local/nginx/sbin/nginx -s quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment