mac 安装 nginx
我是用root用户装的
1.先安装PCRE库
可以在这里下载最新版,我这里使用的是8.33的版本然后在终端执行下面的命令。
tar xvzf pcre-8.33.tar.gz
cd pcre-8.12
sudo ./configure --prefix=/usr/local
sudo make
sudo make install
yum install gcc-c++
yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
2.下载安装nginx
首先在nginx官网下载最新的源码,我这里用的是nginx-1.5.2
cd nginx-1.5.2
./configure --prefix=/usr/local/nginx
默认编译概要:
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library
# 默认编译参数对应的安装路径(*_temp 为目录)
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
nginx error log file: "/usr/local/nginx/logs/error.log"
nginx http access log file: "/usr/local/nginx/logs/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
nginx http uwsgi temporary files: "uwsgi_temp"
nginx http scgi temporary files: "scgi_temp"
为了方便:
sudo ln -s /usr/local/nginx/conf /etc/nginx
sudo ln -s /usr/local/nginx/logs/nginx.pid /var/run/nginx.pid
sudo ln -s /usr/local/nginx/logs /var/log/nginx
或者直接在编译时设定
--prefix=/usr/local \
--sbin-path=/usr/local/sbin \
--conf-path=/etc/nginx \
--pid-path=/var/run \
--error-log-path=/var/log/nginx \
--http-log-path=/var/log/nginx
编译参数参考 Nginx InstallOption
3.启动Nginx
检查PATH环境变量
启动Nginx
需要停止Nginx的时候运行
4.配置自启动
创建文件 /System/Library/LaunchDaemons/nginx.plist
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>nginx</string>
<key>Program</key><string>/usr/local/sbin/nginx</string>
<key>KeepAlive</key><true/>
<key>NetworkState</key><true/>
<key>StandardErrorPath</key><string>/var/log/system.log</string>
<key>LaunchOnlyOnce</key><true/>
</dict>
</plist>
载入自启动文件
转载于:https://www.cnblogs.com/ytfcz/p/3474907.html
mac 安装 nginx相关推荐
- 苹果电脑mac安装nginx教程
苹果电脑MAC安装nginx教程 使用homebrew安装,提醒需要翻墙,最后面介绍的源码安装方式不需要翻墙,只需要在墙内搞到源码即可,建议先确认一下自己能否翻墙,如果可以翻墙就用第一种方法,如果不能 ...
- Mac安装nginx配置过程
mac电脑系统重装了,记录一下安装nginx的过程: 1.打开终端 2.安装Command Line tools xcode-select --install 3.安装brew命令 1 ruby -e ...
- mac 安装nginx与switchhosts 并在微信开发者工具调试h5项目
一.nginx 安装参考:(亲测有用) Mac 安装 brew(最新教程,绝对可行,一行代码搞定,不报错) - LeeHua - 博客园 nginx按照
- mac安装nginx教程
题记:对接项目用到了nginx才发现买了mac从没摸过nginx,记录一下在mac上安装nginx的经历! 一.使用brew安装nginx 1,安装: brew install nginx 2,查看安 ...
- Mac 安装Nginx详细教程
目录 一.前言 二.正文 1.安装 Homebrew 2.brew安装nginx 3.启动nginx服务,如下命令: 三.总结nginx常见的配置 1.nginx启动: 2.nginx停止 一.前言 ...
- 【mac】mac 安装nginx
文章目录 1.概述 2.我的环境 3.安装工具 4.安装negix 4.1 打开终端,习惯性命令 4.2 search 4.3 info 4.4. 开始安装 4.5 查看 4.6 启动nginx 4. ...
- mac ---- 安装nginx
1.打开终端,习惯性命令: brew update brew search nginx //查询要安装的软件是否存在 brew info nginx //查看安装信息 brew install ngi ...
- mac电脑安装nginx+php
一.安装nginx #安装nginx brew install nginx#查看nginx版本 nginx -Vcd /usr/local/etc/nginxls -l#如果没有nginx.conf执 ...
- MAC:使用homebrew安装nginx
前提:成功安装homebrew 1.打开终端输入 brew install nginx 如果报以下错误: 解决方案: fatal: not in a git directory Error: Comm ...
最新文章
- sina微博api源码阅读之函数
- als算法参数_Spark2.0协同过滤与ALS算法介绍
- 002 辅助框架的设计
- JQuery实现动态插入HTML模块
- 【设计模式】—— 适配器模式Adapter
- 年轻人也太禁不起诱惑了吧?
- java中的case1怎么说_Java Cas20ServiceTicketValidator類代碼示例
- 计算机电源稳压,一种用于计算机的电源稳压电路
- 被面试官虐过之后,他轻蔑的问我:你还说你了解单例模式吗?
- stylegan-encoder代码执行步骤和解释
- 【“互联网+”大赛华为云赛道】CloudIDE命题攻略:明确业务场景,快速开发插件
- libevent简述
- JS开发之Factory(工厂)模式解析
- [转载] MLDN魔乐科技李兴华主讲Oracle——02 Oracle安装
- Django 清空数据库的所有表
- 计算机网络管理员四级理论知识试卷,2014计算机网络管理员模拟试题及答案
- cpp读取分数并进行求和化简
- Temu拼多多跨境店铺如何快速上货?
- KEEP TURE
- Visual Studio Code (Ubuntu)安装与配置
热门文章
- imp 只导表前10条数据_Excel数据规范化10条原则,让你的工作效率快速提升
- 利用MEGA32制作辉光数码管显示电路
- 2021年春季学期-信号与系统-第十二次作业参考答案-第七小题
- 智能车竞赛动力锂电池
- 新创建的Django项目Django administration用户名和密码配置
- js php 实现日历签到_PHP 可能在未来十年内消失?
- oracle行转列和列转行,oracle行转列和列转行(pivot 和 unpivot 函数,wm_concat函数 )...
- java i 底层原理,《Java基础知识》Java Hash底层原理
- 极大似然估计_干货|一文理解极大似然估计
- ios与html数据交互,iOS iOS与html进行交互