Server Mac installation Nginx environment

Source: Internet
Author: User
The previous period of contact with the proxy server, in the groping under the installation of Nginx environment, next to introduce you on the MAC installed Nginx environment basic steps.

  1. This article is to use homebrew to install Nginx, first open the Terminal Input installation command line
    Ruby-e "$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
    To install the homebrew. Official website: http://brew.sh/.
    If the following prompt appears, the MAC is installed Nginx or the last installation Nginx failed to leave a residue
    It appears Homebrew is already installed. If your intent is to reinstall Youshould does the following before running this installer again:    Rm-rf/usr/local/cella R/usr/local/.git && Brew Cleanup
    Follow the prompts to enter the Delete command line:
    Rm-rf/usr/local/cellar/usr/local/.git && Brew Cleanup
    After deletion, enter the installation command line.
  2. After download homebrew will automatically install homebrew, with brew one click Install Nginx
    Brew Install Nginx
  3. Test Nginx after installation to work properly
    NGINX-T correct hint: nginx:the configuration file/usr/local/etc/nginx/nginx.conf syntax is OK         nginx:configuration file/us R/local/etc/nginx/nginx.conf Test is successful
  4. If you have insufficient prompt permission, you need to open the permissions of the file under Nginx
    chmod 777 Filefile for file paths that require open access
  5. Nginx can work properly, first change the Nginx configuration file
    Vim/usr/local/etc/nginx/nginx.conf
    server {        Listen       9999 (custom port number);        server_name  localhost;        #charset Koi8-r;        #access_log  logs/host.access.log  main;        Location/{            root   /users/loki/desktop/web/(the file path to deploy the application);            index  index.html index.htm;        }
  6. After the configuration file has changed, start Nginx
    sudo nginx
  7. Basic usage of Nginx
    Nginx-s Reload    #重新加载配置nginx-S reopen   #重启nginx-S Stop #停止nginx-s       quit        #退出
    Options:    -?,-H           : Open Help message              -V: Displays version information and    exits              -V: Displays version and configuration options information, and then exits-    t              : Detects if a configuration file has a syntax error and then exits              -Q: Masking non-error messages during configuration file-    s signal       : Sends a signal to an nginx main process: Stop (stop), quit (quit), reopen (restart), Reload (reload config file)-    p prefix       : Set prefix path (default is:/usr/local/cellar/nginx/1.2.6/)-    c filename     : Set configuration file (default:/usr/local/etc/nginx/nginx.conf)    -G directives   : set global directives outside the configuration file

The above describes the server Mac installation Nginx environment, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • 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.