Build nginx environment on mac

Source: Internet
Author: User

 

Nginx is a lightweight, high-performance HTTP and reverse proxy server. It is successfully installed on MAC today.

 

I installed it through brewhome, which is very simple. Brew install nginx is smooth all the way...

 

The following is the installation information.

HematoMacBook-Pro :~ Hechangmin $ brew search nginx

Nginx

HematoMacBook-Pro :~ Hechangmin $ brew install nginx

==> Installing nginx dependency: pcre

==> Downloading ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.13.

######################################## ################################ 100.0%

######################################## ################################# 100.0% ==>. /configure -- prefix =/usr/local/Cellar/pcre/8.13 -- enable-utf8 -- enable-unic

==> Make test

==> Make install

/Usr/local/Cellar/pcre/8.13: 111 files, 2.9 M, built in 54 seconds

==> Installing nginx

==> Downloading http://nginx.org/download/nginx-1.0.8.tar.gz

######################################## ################################ 100.0%

==> Patching

Patching file auto/lib/pcre/conf

Patching file conf/nginx. conf

==>. /Configure -- prefix =/usr/local/Cellar/nginx/1.0.8 -- with-http_ssl_module -- with-pcre -- conf-path =/usr/local/etc/nginx. conf -- pid-path =/usr/local/var/run/nginx. pid -- lock-path =/usr/local/var/ngi

==> Make install

==> Caveats

In the interest of allowing you to run 'nginx' without 'sudo', the default

Port is set to localhost: 8080.

 

If you want to host pages on your local machine to the public, you showould

Change that to localhost: 80, and run 'sudo nginx'. You'll need to turn off

Any other web servers running port 80, of course.

 

You can start nginx automatically on login running as your user:

Mkdir-p ~ /Library/LaunchAgents

Cp/usr/local/Cellar/nginx/1.0.8/org. nginx. nginx. plist ~ /Library/LaunchAgents/

Launchctl load-w ~ /Library/LaunchAgents/org. nginx. nginx. plist

 

Though note that if running as your user, the launch agent will fail if you

Try to use a port below 1024 (such as http's default of 80 .)

Warning:/usr/local/sbin is not in your PATH

You can amend this by altering your ~ /. Bashrc file

==> Summary

/Usr/local/Cellar/nginx/1.0.8: 6 files, 616 K, built in 19 seconds

HematoMacBook-Pro :~ Hechangmin $

Start nginx and sudo nginx; Access localhost: 8080 and find that the nginx welcome page has appeared.

 

Note: ln-s/usr/local/sbin/nginx/usr/bin/nginx makes a soft connection.

Common Commands include:

View nginx-V version and configuration file address

View nginx-v version

Nginx-c filename specifies the configuration file

Nginx-h help

Nginx-s [reload \ reopen \ stop \ quit]

 

Common brewhome commands:

Brew search mysql: search for specific packages

Brew install mysql: install a specific package

Brew info mysql: view the specific program information

Brew uninstall mysql: uninstall a specific application (mysql is used as an example here)

 

 

My configuration file address:/usr/local/etc/nginx. conf

Edit content to create web directories, PHP, python, etc.

From:-274 ° c

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.