unix,mac下安装nginx

安装nginx前面必须安装pcre,zlib和ssl

1.安装pcre

首先下载pcre,地址是:http://nchc.dl.sourceforge.net/project/pcre/pcre2/10.20/pcre2-10.20.tar.bz2

tar -xvf pcre2-10.20.tar.bz2
cd pcre2-10.20
sudo ./configure
sudo make
sudo make install

2.安装zlib

下载zlib,地址:http://zlib.net/zlib-1.2.8.tar.gz

tar -xvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
sudo ./configure
sudo make
sudo make isntall

3.安装ssl

下载openssl,下载地址:http://www.openssl.org/source/openssl-1.0.1o.tar.gz

tar openssl-1.0.1o.tar.gz
cd openssl-1.0.1o
sudo ./config
sudo make
sudo make install

4.安装nginx

下载nginx,下载地址:http://nginx.org/download/nginx-1.2.8.tar.gz

tar -xvf nginx-1.2.8.tar.gz
cd nginx-1.2.8
sudo ./configure --prefix=/usr/local/nginx
sudo make
sudo make install

这个时间mac会显示报错md5编译不通过,具体错误信息如下:

src/core/ngx_crypt.c:82:5: error: ‘MD5_Init‘ is deprecated: first deprecated in OS X 10.7 [-Werror,-Wdeprecated-declarations]
    ngx_md5_init(&md5);
    ^
src/core/ngx_md5.h:30:25: note: expanded from macro ‘ngx_md5_init‘
#define ngx_md5_init    MD5_Init
                        ^
/usr/include/openssl/md5.h:113:5: note: ‘MD5_Init‘ has been explicitly marked deprecated here
int MD5_Init(MD5_CTX *c) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
src/core/ngx_crypt.c:83:5: error: ‘MD5_Update‘ is deprecated: first deprecated in OS X 10.7 [-Werror,-Wdeprecated-declarations]
    ngx_md5_update(&md5, key, keylen);
    ^
src/core/ngx_md5.h:31:25: note: expanded from macro ‘ngx_md5_update‘
#define ngx_md5_update  MD5_Update
                        ^
/usr/include/openssl/md5.h:114:5: note: ‘MD5_Update‘ has been explicitly marked deprecated here
int MD5_Update(MD5_CTX *c, const void *data, size_t len) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
src/core/ngx_crypt.c:84:5: error: ‘MD5_Update‘ is deprecated: first deprecated in OS X 10.7 [-Werror,-Wdeprecated-declarations]
    ngx_md5_update(&md5, (u_char *) "$apr1$", sizeof("$apr1$") - 1);
    ^
src/core/ngx_md5.h:31:25: note: expanded from macro ‘ngx_md5_update‘
#define ngx_md5_update  MD5_Update
                        ^
/usr/include/openssl/md5.h:114:5: note: ‘MD5_Update‘ has been explicitly marked deprecated here
int MD5_Update(MD5_CTX *c, const void *data, size_t len) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
src/core/ngx_crypt.c:85:5: error: ‘MD5_Update‘ is deprecated: first deprecated in OS X 10.7 [-Werror,-Wdeprecated-declarations]
    ngx_md5_update(&md5, salt, saltlen);
    ^
src/core/ngx_md5.h:31:25: note: expanded from macro ‘ngx_md5_update‘
#define ngx_md5_update  MD5_Update
                        ^
/usr/include/openssl/md5.h:114:5: note: ‘MD5_Update‘ has been explicitly marked deprecated here
int MD5_Update(MD5_CTX *c, const void *data, size_t len) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
src/core/ngx_crypt.c:87:5: error: ‘MD5_Init‘ is deprecated: first deprecated in OS X 10.7 [-Werror,-Wdeprecated-declarations]
    ngx_md5_init(&ctx1);
    ^
src/core/ngx_md5.h:30:25: note: expanded from macro ‘ngx_md5_init‘
#define ngx_md5_init    MD5_Init
                        ^
/usr/include/openssl/md5.h:113:5: note: ‘MD5_Init‘ has been explicitly marked deprecated here
int MD5_Init(MD5_CTX *c) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
    ^
src/core/ngx_crypt.c:88:5: error: ‘MD5_Update‘ is deprecated: first deprecated in OS X 10.7 [-Werror,-Wdeprecated-declarations]
    ngx_md5_update(&ctx1, key, keylen);

解决方案,重新编译

sudo ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-cc-opt="-Wno-deprecated-declarations"
sudo make
sudo make install

5.启动

/usr/local/nginx/sbin/nginx

打开localhost或者127.0.0.1

打开浏览器,如果是Welcome to nginx!,说明启动成功

6.重启

sudo /usr/local/nginx/sbin/nginx –s reload

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-10-25 06:30:34

unix,mac下安装nginx的相关文章

mac下安装nginx问题解决

需要在mac上安装nginx,按照下面的博客链接一步步安装,但是碰到了些问题.下面写一下我的解决方式. (http://stevendu.iteye.com/blog/1535466) 1. 安装PCRE  Download latest PCRE. After download go to download directory from terminal. $ cd ~/Download $ tar xvzf pcre-8.12.tar.gz $ cd pcre-8.12 $ sudo ./c

《OD大数据实战》mac下安装nginx+php

一.mac安装nginx + php + php-fpm  或apache + php 1. Mac 下 Nginx.MySQL.PHP-FPM 的安装配置 2. Mac下安装LNMP(Nginx+PHP5.6)环境 3. 在Mac OS X中配置Apache + PHP + MySQL 二.Centos安装apache + php + mysql 1.

mac下安装nginx和php

一.前话:1.1.环境选择:重新在mac上配置php,原本mac上就自带有apach.php以及pgsql,如果图简单的话,直接用就可以了,不过在安装前我仔细思考了一下几个问题:选apache还是nginx:两个我了解的都比较少,相对而言我接触nginx比较多,服务器用的也是nginx,没办法谁叫nginx负载高呢.为了更好的接触nginx的环境,我决定还是统一下环境,方便今后使用,这是这次的主要关键:安 装php:Mac os自带了php,好像是5.3.8,版本比较落后,不过这不碍事,因为以前

mac下安装nginx

mac下自带Homebrew可以简单认为就是brew,执行命令brew -v查看版本 feng:AwesomeProject nian$ brew -v Homebrew 1.1.5 Homebrew/homebrew-core (git revision 6595; last commit 2016-12-27) 如果没有安装,可以到brew官网,http://brew.sh/  按照说明安装即可,其实就是一条命令傻瓜式安装, /usr/bin/ruby -e "$(curl -fsSL ht

mac 下安装nginx

1,mac下的依赖: pcre-8.38.tar.gz nginx-1.4.7.tar.gz 2,解压pcre:进入器解压目录. EddydeMacBook-Pro:~ eddy$ cd /Users/eddy/soft/pcre-8.38 EddydeMacBook-Pro:pcre-8.38 eddy$ sudo ./configure --prefix=/usr/local 注: nginx默认是安装到/opt目录下,在mac系统中是没有/opt目录的,所以用--prefix指定目标目录

mac下安装nginx+php+mysql

一,安装homebrew 就像linux下面有yum一样,mac也有个homebrew,管理软件非常便捷. 官网:http://brew.sh/index_zh-cn.html 上面有句命令,复制下来终端执行,如果命令返回404没找到,命令以官网最新为参考. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 任意键继续,可能需要输入你MAC的开机密码 漫长的

Mac下安装nginx并配置SSL实现Https的访问

一.nginx安装 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew install nginx    // 安装nginx nginx -v    // 显示版本号 打开nginx文件夹 cd /usr/local/etc/nginx 启动nginx sudo nginx 或者 nginx 在浏览器中输入 localhost 访问即可,如出现以下

mac 下 安装nginx

下载相应版本的nginx 解压进入该版本的目录下 在命令行执行 ./configure  --with-cc-opt="-Wno-deprecated-declarations" --without-http_rewrite_module 执行  make 执行 make install 执行 sudo /usr/local/nginx/sbin/nginx

Mac下安装LNMP(Nginx+PHP5.6)环境

Mac下安装LNMP(Nginx+PHP5.6)环境 安装Homebrew 最近工作环境切换到Mac,所以以OS X Yosemite(10.10.1)为例,记录一下从零开始安装Mac下LNMP环境的过程 确保系统已经安装xcode,然后使用一行命令安装依赖管理工具Homebrew ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 之后就可以使用 brew