Mac installation Nginx tutorial

1. Install nginx First install homebrew

1.  HomebrewIt is a package management tool that currently supports macOSand linuxsystem

Install

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"

Uninstall (using the official script will also encounter uninstallthe problem that the address cannot be accessed, you can use the following script:)

/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/uninstall.sh)"

2. Configure environment variables

  If it is m1a chip, Macyou need to manually set the environment variable:

zsh:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

bash:

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.bash_profile
eval "$(/opt/homebrew/bin/brew shellenv)"

For non- m1chip, you can try to manually add environment variables:

zsh

echo 'eval "$(/usr/local/Homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/usr/local/Homebrew/bin/brew shellenv)"

bash

echo 'eval "$(/usr/local/Homebrew/bin/brew shellenv)"' >> ~/.bash_profile
eval "$(/usr/local/Homebrew/bin/brew shellenv)"

Two, install nginx

1. Query whether the software to be installed exists

brew search nginx  

2. View information about installing nginx

brew info nginx

 3. Install

brew install nginx

 Then enter the nginx configuration file path through open

Replenish:

启动命令: nginx

快速停止命令 nginx -s stop

平稳退出命令:nginx -s quit

重新启动:nginx -s reload

重新加载配置文件命令:nginx -s reload

检查配置文件正确性:nginx -t

查询nginx主进程号:ps -ef | grep nginx

正常停止:kill -QUIT 主进程号

快速停止:kill -TERM 主进程号 /kill -INT 主进程号

强制停止:kill -9 主进程号

Guess you like

Origin blog.csdn.net/qq_42717015/article/details/130098477