Linux 安装Nginx详细图解教程
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Linux 安装Nginx详细图解教程,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2024字,纯文字阅读大概需要3分钟。
内容图文
![Linux 安装Nginx详细图解教程](/upload/InfoBanner/zyjiaocheng/1092/fe185bf0d34c4e87b48cf0217cc07627.jpg)
系统:Centos6.6 64位
Nginx: http://nginx.org/en/download.html 目前最新版本1.9.4 我下载1.8.0
下载模块依赖性Nginx需要依赖下面3个包
1.gzip 模块需要 zlib 库 ( 下载: http://www.zlib.net/ )
2.rewrite 模块需要 pcre 库 ( 下载: http://www.pcre.org/ )
3.ssl 功能需要 openssl 库 ( 下载: http://www.openssl.org/ )
依赖包安装顺序依次为:openssl、zlib、pcre, 然后安装Nginx包
如果没有安装c++编译环境,还得安装,通过yum install gcc-c++完成安装
下载完成后:
下一步,编译安装
openssl :
[root@localhost] tar zxvf openssl-fips-2.0.9.tar.gz
[root@localhost] cd openssl-fips-2.0.9
[root@localhost] ./config && make && make install
pcre:
[root@localhost] tar zxvf pcre-8.36.tar.gz
[root@localhost] cd pcre-8.36
[root@localhost] ./configure && make && make install
zlib:
[root@localhost]tar zxvf zlib-1.2.8.tar.gz
[root@localhost] cd zlib-1.2.8
[root@localhost] ./configure && make && make install
最后安装nginx
[root@localhost]tar zxvf nginx-1.8.0.tar.gz
[root@localhost] cd nginx-1.8.0
[root@localhost] ./configure && make && make install
安装完成后,可启动nginx:
![技术分享](/upload/getfiles/default/2022/11/10/20221110104831081.jpg)
启动命令:/usr/local/nginx/sbin/nginx
发现报错了:
error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
经网上查询,这是linux的通病
[root@localhost nginx]# sbin/nginx
sbin/nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
[root@localhost nginx]# error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
[root@localhost nginx]# whereis libpcre.so.1
libpcre.so: /lib64/libpcre.so.0 /usr/local/lib/libpcre.so /usr/local/lib/libpcre.so.1
[root@localhost nginx]# ln -s /usr/local/lib/libpcre.so.1 /lib64
[root@localhost nginx]# sbin/nginx
先找到libpcre.so.1所在位置,然后做个软链接就可以了。
查看是否已启动:
通过浏览器访问:
看到这个就说明nginx安装并启动成功。
ps:
启动:/usr/local/nginx/sbin/nginx停止/重新加载:/usr/local/nginx/sbin/nginx -s stop(quit、reload)
验证配置文件是否合法:/usr/local/nginx/sbin/nginx -t
命令帮助:/usr/local/nginx/sbin/nginx -h
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文:http://blog.csdn.net/grhlove123/article/details/47834673
内容总结
以上是互联网集市为您收集整理的Linux 安装Nginx详细图解教程全部内容,希望文章能够帮你解决Linux 安装Nginx详细图解教程所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。