Nginx compilation Install on Mac

Source: Internet
Author: User
Tags image filter

First, compile the installation module
If there is a module in the original package, compile,./configure--with-xxx, if it is a third-party module, you can use--add-module, if there are multiple modules, you only need to use the-add-module command multiple times.
Ii. Download the source package Image_fliter and Echo module
Nginx source Download Http://nginx.org/en/download.htmlecho module Download Https://github.com/openresty/echo-nginx-module/tags decompression gzip-d XXX.TAR.GZTAR-ZVXF Xxx.tar  xxx
Three. Compiling 1. Installation dependencies:
Brew Install Pcrebrew Install GD #image Filter relies on gdbrew link--force OpenSSL #避免编译openssl时报错
2.CD Nginx Source Directory
./configure Xxx--prefix Set compilation directory
3. View the original Nginx compilation parameters
Nginx-v
4. Add the Compile module
./configure \--with-http_image_filter_module--with-debug--add-module=/users/fanfan/web/software/ echo-nginx-module-0.61 the original compilation parameters, (note modifying the version directory)./configure--prefix=/usr/local/cellar/nginx/1.12.2--with-http_ssl_ Module--with-pcre--sbin-path=/usr/local/cellar/nginx/1.12.2/bin/nginx--with-cc-opt= '-I/usr/local/opt/pcre/ Include-i/usr/local/opt/[email protected]/include '--with-ld-opt= '-l/usr/local/opt/pcre/lib-l/usr/local/ Opt/[email protected]/lib '--conf-path=/usr/local/etc/nginx/nginx.conf--pid-path=/usr/local/var/run/ Nginx.pid--lock-path=/usr/local/var/run/nginx.lock--http-client-body-temp-path=/usr/local/var/run/nginx/client _body_temp--http-proxy-temp-path=/usr/local/var/run/nginx/proxy_temp--http-fastcgi-temp-path=/usr/local/var/ Run/nginx/fastcgi_temp--http-uwsgi-temp-path=/usr/local/var/run/nginx/uwsgi_temp--http-scgi-temp-path=/usr/ Local/var/run/nginx/scgi_temp--http-log-path=/usr/local/var/log/nginx/access.log--error-log-path=/usr/local/ Var/log/nginx/error.log--with-http_gzip_static_module--with-http_v2_module--with-http_image_filter_module--with-debug--add-module=/ Users/fanfan/web/software/ echo-nginx-module-0.61------------------------------------------------------------------------------./ Configure--prefix=/usr/local/nginx-1.4.1--with-http_stub_status_module--with-http_realip_module--with-http_ Image_filter_module--with-debug
5.make four. Installation 1. If the Nginx is not previously installed
Make install
2. If you have previously installed Nginx through brew
/usr/local/bin/nginx   /usr/local/cellar/nginx/xxx/bin/nginx/usr/local/opt/nginx   /usr/local/Cellar/nginx /xxx Modify the soft connection, pointing directly to the new Nginx
3. How to replace the compiled file
This way, just replace the bin file, the directory or the original # back up the original binarycp/usr/local/opt/nginx/bin/nginx/usr/local/opt/nginx/bin/nginx.bak# First CD to Nginx source directory sudo cp objs/nginx/usr/local/opt/nginx/bin/nginxrm/usr/local/bin/nginxln-s/usr/local/opt/nginx/bin/ Nginx/usr/local/bin/nginx
4. How to create a version directory
$ cp-r/usr/local/cellar/nginx/1.8.0/usr/local/cellar/nginx/1.9.10# First CD to Nginx source directory $ sudo cp objs/nginx/usr/local/ cellar/nginx/1.9.10/bin# update/usr/local/opt/nginx$ rm/usr/local/opt/nginx$ ln-s/usr/local/cellar/nginx/xxx/usr/ local/opt/nginx# update/usr/local/bin/nginx$ rm/usr/local/bin/nginx$ ln-s/usr/local/opt/nginx/bin/nginx/usr/local/bin /nginx
5. Edit/library/launchdaemons/homebrew.mxcl.nginx.plist
It doesn't seem to be editing launchctl load-f/library/launchdaemons/homebrew.mxcl.nginx.plist
Five. Verify Nginx
Nginx-v/Nginx-vyld:library not loaded: The/usr/local/opt/jpeg/lib/libjpeg.8.dylibnginx version relies on the version of JPEG 8d, and the brew install JPEG , install the new version of 9b can be converted to a previous release can be brew switch jpeg 8d or because of other version installation This problem can be reinstalled, rebuild source, so that using the latest version of the dependent Brew cleanup// Update cellarbrew Reinstall PHP71--build-from-sourcehttps://stackoverflow.com/questions/32703296/ dyld-library-not-loaded-usr-local-lib-libjpeg-8-dylib-homebrew-php
Six. Restart Nginx
NGINX-T//Verify that the configuration file is correct, there may be a permissions issue, start with the root user can sudo brew services restart Nginx
Seven. Reference links
https://blog.chionlab.moe/2016/02/02/compile-nginx-on-osx/https://blog.haohtml.com/archives/12349

Nginx compilation Install on Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.