博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux下源码安装Nginx服务
阅读量:4684 次
发布时间:2019-06-09

本文共 1374 字,大约阅读时间需要 4 分钟。

nginx 安装

linux 系统需要安装必备的开发包,比如 gcc,gcc-c++

    1. 

openssl (支持 https)

https://www.openssl.org/source/openssl-1.0.2.tar.gz

tar -zxvf openssl-1.0.2.tar.gz # 下载并解压,然后 cd 到安装目录,下同

./config --prefix=/usr/local --openssldir=/usr/local/opensslmake  make test make install
    2. 

pcre: (支持转发组件)

./configure make make install
    3. 

nginx:

./configure --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --with-openssl=/opt/package/openssl-1.0.2amake &&  make install

注意如果 ./configure 提示 error: the HTTP gzip module requires the zlib library... ,可以 yum -y install zlib-devel 或手动安装 zlib-devel,如果不需要此功能,可以在 ./configure 加上--without-http_gzip_module

注意:--with-openssl=/usr/local/openssl 修改 openssl 压缩包的的解压目录,我的测试机为/opt/package/openssl-1.0.2a

参考: 其它 nginx 常用编译选项 开启 http_realip_module 模块

--with-http_realip_module  : nginx 代理后获取真实 ip,--with-http_stub_status_module --with-http_ssl_module  :支持 https

启动 nginx,

cd /usr/local/nginx/sbin./nginx  &

启动不报错说明 nginx已经正常运行

解决 error while loading shared libraries: libpcre.so.1的错误

/usr/local/webserver/nginx/sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
解决方法:

ln -s /usr/local/lib/libpcre.so.1 /lib  /lib64

其它 nginx 命令参考

nginx -t # 检查配置文件语法是否正确 nginx -s reload #重新加载修改后的配置文件 nginx -V # 查看编译参数 nignx -v # 查看版本

转载于:https://www.cnblogs.com/TaleG/p/5352335.html

你可能感兴趣的文章
[转]LINUX新建和增加SWAP分区
查看>>
(上线时清缓存)laravel 5.1 的程序性能优化(配置文件) - 简书
查看>>
SettingsSVNPlugin
查看>>
华为经典问题汇总~
查看>>
linux桌面环境gnome,kde,xfce,lxde 使用比较(转)
查看>>
如何做自己不想做的事情,却必须要去做的事情
查看>>
JavaScript的深入理解(1)
查看>>
Go-TCP粘包
查看>>
KNN算法的感受 1
查看>>
用Maven构建Mahout项目实现协同过滤userCF--单机版
查看>>
Java多线程-线程的调度(守护线程)
查看>>
Bootstrap 简介(Web前端CSS框架)
查看>>
Bootstrap 概览
查看>>
nginx配置ssl证书实现https访问
查看>>
c# while穷举(凑钱)
查看>>
EnCase v7 could not recognize Chinese character folder names / file names on Linux Platform
查看>>
c#中序列化和反序列化的理解
查看>>
c#Socket通信
查看>>
第七周翻译
查看>>
HTTPS协议的实现原理
查看>>