01-Nginx服务器的安装

来源:互联网 发布:运动软件免费下载 编辑:程序博客网 时间:2024/06/05 21:03

Ninx服务器的Mac安装


安装方式

首先需要安装HomeBrew
然后在终端中输入如下命令

brew install nginx

相关重要提示信息

Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

nginx will load all files in /usr/local/etc/nginx/servers/.

To have launchd start nginx now and restart at login:
brew services start nginx
Or, if you don’t want/need a background service you can just run:
nginx

命令

brew services start nginx 启动nginx的服务 localhost:8080访问
brew services stop nginx 停止nginx的服务
nginx -V 查看版本以及配置文件地址
nginx -v 产看版本信息
nginx -c filename 指定配置文件

重新加载配置|重启|停止|退出
nginx -s reload | reopen | stop | quit

打开nginx
sudo nginx

原创粉丝点击