CentOS 7 搭建nginx
2016-07-22 21:09
567 查看
nginx依赖
nginx依赖以下模块:
gzip模块依赖 zlib 库
地址http://www.zlib.net/我下载的最新版zlib-1.2.8tar.gz,解压,进入目录执行./configure
make
make install
rewrite模块依赖 pcre 库
地址http://www.pcre.org/【注意】安装pcre库的时候走了个小弯路,现在pcre已经有了pcre2版本、因为我以为2版本也可以、所以先下载的pcre2-10.20.tat.gz版本,结果在安装nginx时提示大概是找不到pcre库,马上又载了个pcre-8.37.tar.gz
跟上面一样,解压 ,进入目录 ./configure
make
make install
ssl 功能依赖openssl的crypto库
地址http://www.openssl.org/source/openssl我下载的openssl-1.1.0-pre5,默认安装的话libcrypto.so.1.1在/usr/local/lib64/,但是nginx寻找依赖在/lib64/目录下,会导致提示找不到libcrypto.so.1.1,用命令ldd $(which /usr/local/nginx/sbin/nginx)没有libcrypto.so.1.1,所以直接把libcrypto.so.1.1复制到/lib64/目录下,找不到库目录的话安装后可以用 openssl version -a现在安装路径
解压,进入目录执行./configure
make
make install
安装nginx
在http://nginx.org/en/download.html上可以下载当前最新的版本。我下载的nginx-1.10.1.tar.gz,目前是最新的
解压,进入目录,执行./configure
make
make install
1.10.1的执行文件在/usr/local/nginx/sbin/nginx跟旧版有所不同
安装完就可以直接在浏览器访问localhost,就会看到
Welcome to nginx!
If you see this page, the nginx web server is successfully installed >and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.
配置nginx
配置文件在/usr/local/nginx/conf/nginx.conf,基本配置比较简单listen 80;默认监听80端口
server_name localhost;服务器地址
相关文章推荐
- nginx代理指定目录
- 访问Nginx发生SSL connection error的一种情况
- Centos6 编译安装Python
- Nginx+Naxsi部署专业级Web应用防火墙
- 硬盘安装CentOS 6.2以及添加GRUB启动菜单
- CentOS 6.2实战部署Nginx+MySQL+PHP
- nginx中http核心模块的配置指令2
- nginx中http核心模块的配置指令3
- nginx中http核心模块的配置指令4
- nginx中http的fastcgi模块的配置指令1
- CentOS 7系统配置上的变化解析
- Nginx 学习笔记(一)
- 网站502与504错误分析
- 用zabbix监控nginx_status状态
- CentOS下DB2数据库安装过程详解
- CentOS 6.3下编译安装Ruby 2.0笔记