服务器 mac安装nginx环境
来源:互联网 发布:php 源码 owncloud 编辑:程序博客网 时间:2024/04/30 10:54
前段时间接触到了代理服务器,在摸索下搭建了nginx环境,接下来给大家介绍一下在mac上安装nginx环境的基本步骤。
- 本文是利用homebrew来安装nginx,先打开终端输入安装命令行
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
来安装homebrew。官网:http://brew.sh/ 。
若出现以下提示,则说明mac已安装nginx或者上一次安装nginx失败留下残余It appears Homebrew is already installed. If your intent is to reinstall youshould do the following before running this installer again: rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
按照提示输入删除命令行:rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
删除后,再输入安装命令行。 - 下载homebrew后会自动安装homebrew,用brew一键安装nginx
brew install nginx
- 安装后测试nginx是否能正常工作
nginx -t正确提示:nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
- 若有提示权限不够,则需要开放nginx下文件的权限
chmod 777 filefile为需要开放权限的文件路径
- nginx能正常工作后,先更改nginx的配置文件
vim /usr/local/etc/nginx/nginx.conf
server { listen 9999(自定义端口号); server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root /Users/loki/Desktop/web/(需要部署应用的文件路径); index index.html index.htm; }
- 配置文件更改完,启动nginx
sudo nginx
- nginx的基本用法
nginx -s reload #重新加载配置nginx -s reopen #重启nginx -s stop #停止nginx -s quit #退出
选项: -?,-h : 打开帮助信息 -v : 显示版本信息并退出 -V : 显示版本和配置选项信息,然后退出 -t : 检测配置文件是否有语法错误,然后退出 -q : 在检测配置文件期间屏蔽非错误信息 -s signal : 给一个 nginx 主进程发送信号:stop(停止), quit(退出), reopen(重启), reload(重新加载配置文件) -p prefix : 设置前缀路径(默认是:/usr/local/Cellar/nginx/1.2.6/) -c filename : 设置配置文件(默认是:/usr/local/etc/nginx/nginx.conf) -g directives : 设置配置文件外的全局指令
0 0
- 服务器 mac安装nginx环境
- mac 安装 nginx 环境
- mac 安装 nginx 环境
- mac安装nginx环境
- mac 安装 nginx 环境
- mac 安装 nginx 环境
- mac 安装 nginx 环境
- mac安装nginx环境
- mac 安装 nginx 环境
- mac 安装 nginx 环境
- mac 安装 nginx 环境
- mac 安装 nginx 环境
- Mac利用brew安装nginx环境
- MAC环境下安装和配置Nginx
- Mac环境编译安装Nginx+PHP7
- Mac下Nginx安装环境配置详解
- 服务器-Nginx-Mac OS X 下编译安装 Nginx
- Linux搭建Java服务器环境-Nginx安装
- 必须在类初始化列表中初始化的几种情况
- 完美适应iOS中的键盘高度变化
- 资源列表
- Java中urlrewriter的使用
- Socket 网络通信协议 http、TCP/IP协议与socket之间的区别
- 服务器 mac安装nginx环境
- Selenium webdriver操作日历控件
- 【Java类和对象】奥特曼打怪兽练习
- 全局静态存储区、堆区和栈区深入剖析
- 关于big-endian和little-endian小程序
- 傅盛豹变
- libpomelo使用
- 官方否认"成都金牛区政协会上警察抓人"
- C++String 类中的常用函数