unix,mac下安装nginx
2015-07-07 14:03
585 查看
安装nginx前面必须安装pcre,zlib和ssl
1.安装pcre
首先下载pcre,地址是:http://nchc.dl.sourceforge.net/project/pcre/pcre2/10.20/pcre2-10.20.tar.bz2
2.安装zlib
下载zlib,地址:http://zlib.net/zlib-1.2.8.tar.gz
3.安装ssl
下载openssl,下载地址:http://www.openssl.org/source/openssl-1.0.1o.tar.gz
4.安装nginx
下载nginx,下载地址:http://nginx.org/download/nginx-1.2.8.tar.gz
这个时间mac会显示报错md5编译不通过,具体错误信息如下:
解决方案,重新编译
5.启动
/usr/local/nginx/sbin/nginx
打开localhost或者127.0.0.1
打开浏览器,如果是Welcome to nginx!,说明启动成功
6.重启
sudo /usr/local/nginx/sbin/nginx –s reload
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
相关文章推荐
- nginx解析php文件及问题
- 08-nginx网站的配置过程记录
- windows下配置nginx+php
- GoAccess nginx日志分析工具
- Nginx安装部署
- nginx配置多域名单ip访问不同目录不同应用
- 使用Nginx Upload Module实现上传文件功能
- nginx服务器安装及配置文件详解
- nginx-code
- nginx 源码学习——处理stale event
- nginx实现日志按天切割
- powerdns与nginx结合实现以域名和IP方式访问web服务器80端口时分别跳转到不同页面
- 开放Nginx在文件夹列表功能
- nginx配置多个虚拟ip访问
- Nginx服务器nginx.conf的配置文件说明
- nginx+lua安装配置
- nginx总结
- CentOS 6.5用RPM安装Nginx
- FastDFS的配置、部署与API使用解读(7)Nginx的FastDFS模块
- 如何改变nginx显示静态目录文件的文件名长度