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>
载入自启动文件
mac 安装 nginx的更多相关文章
- mac 安装nginx
首先准备工作,打开mac终端 1.安装brew 输入命令 curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar x ...
- mac 安装 nginx 环境
1.brew search nginx 2.brew install nginx 启动nginx ,sudo nginx ;访问localhost:8080 发现已出现nginx的欢迎页面了. 备注: ...
- Mac安装nginx配置过程
mac电脑系统重装了,记录一下安装nginx的过程: 1.打开终端 2.安装Command Line tools xcode-select --install 3.安装brew命令 ruby -e & ...
- mac 安装nginx,并配置nginx的运行环境
1. 安装nginx // 查询有没有nginx brew search nginx //开始安装nignx brew install nginx 2. 检查nignx是否安装成功 nginx -V ...
- 2019.1.10 Mac安装Nginx服务器
1.安装Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/in ...
- Mac 安装nginx之后重启、停止、开启等操作
操作系统:macOs High Sierra 10.13.6 1.我用的homebrew安装的nignx1.15.9,安装完成之后会有下面的提示: 网站根目录在:/usr/local/var/www ...
- Mac安装Nginx、Mysql、PHP、Redis
安装xcode命令行工具的命令 xcode-select --install 安装homebrew: ruby -e "$(curl -fsSL https://raw.githubus ...
- mac安装nginx
1,http://nginx.org/en/download.html下载http://nginx.org/download/nginx-1.2.0.tar.gz 2,tar -xf nginx-1. ...
- 《OD大数据实战》mac下安装nginx+php
一.mac安装nginx + php + php-fpm 或apache + php 1. Mac 下 Nginx.MySQL.PHP-FPM 的安装配置 2. Mac下安装LNMP(Nginx+P ...
随机推荐
- linux-推荐两款好用的录屏软件
前言 测试程序过程中需要看运行效果如何,可以使用录屏软件进行回放. 软件安装 添加源:sudo add-apt-repository ppa:maarten-baert/simplescreenrec ...
- ElasticSearch(九):springboot项目集成消息中间件activeMQ
目的:为了将elasticsearch做成单独的服务,那么我们必须解耦,也就是业务逻辑和搜索模块是没有关系的,并且是异步的.那么项目之间通信,使用的选择有限,消息中间件是一个不错的选择. 消息中间件常 ...
- MySql5.5安装(windows)
首先贴出安装包 32位安装包链接:https://pan.baidu.com/s/1AGLpcKv1I4kvWjPsVMyS8Q 密码:xypy 64位安装包链接:https://pan.baidu. ...
- smarty学习——内建函数(部分接上)
9.{foreach} {foreachelse} 格式如下: {foreach $arrayvar as $itemvar} {foreach $arrayvar as $keyvar=>$i ...
- webpack 基本使用
1. 创建webpack-test文件夹 2. npm初始化 3. 安装webpack 4. 使用webpack打包 hello.js 是需要打包的文件 hello.bundle.js 是打包完以后 ...
- IONIC 页面之间传递参数
HomePage 定义goToMyPage方法,传递id和name MyPage接收参数
- window下安装两个mysql服务
产生这个想法主要是因为win系统之前装了mysql,服务名为mysql.又重新安装xampp,导致mysql冲突,xampp中的mysql始终启动不起来. 解决方法如下: 1.修改xampp中my ...
- 理解REST和SOA
REST -- REpresentational State Transfer 直接翻译:表现层状态转移. 精辟理解:URL定位资源,用HTTP动词(GET,POST,DELETE,DETC)描述操作 ...
- Mac 下 IDEA 中 SpringBoot 如何利用 DevTool 开启热部署
一.首先 pom.xml 中 依赖 和 构建 部分 二.IDEA 配置 注意这一步一定不要改错地方,认准 IntelliJ IDEA -> Preferences… 三.退出 IDEA 编辑器 ...
- Spring中IOC与DI的的区别
依赖注入的前提: 有IOC的环境,也就是将必须对象的创建权交给了Spring. DI 介绍 Dependency Injection 依赖注入.需要有IOC 的环境,Spring 创建这个类的过程中, ...