nginx安装及介绍(centos6.4)
来源:互联网 发布:new balance跑鞋 知乎 编辑:程序博客网 时间:2024/06/05 20:37
安装nginx:
下载nginx:
官方网站:http://nginx.org/使用的版本是1.8.0版本。(nginx-1.8.0.tar.gz)
要求的安装环境:
1、需要安装gcc的环境。
yum install gcc-c++
2、第三方的开发包。
PCRE
PCRE(Perl Compatible Regular Expressions)是一个Perl库,包括 perl 兼容的正则表达式库。nginx的http模块使用pcre来解析正则表达式,所以需要在linux上安装pcre库。yum install -y pcre pcre-devel
注:pcre-devel是使用pcre开发的一个二次开发库。nginx也需要此库。zlib
zlib库提供了很多种压缩和解压缩的方式,nginx使用zlib对http包的内容进行gzip,所以需要在linux上安装zlib库。
yum install -y zlib zlib-devel
openssl
OpenSSL 是一个强大的安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。
nginx不仅支持http协议,还支持https(即在ssl协议上传输http),所以需要在linux安装openssl库。
yum install -y openssl openssl-devel
安装步骤:
第一步:把nginx的源码包上传到linux系统
第二步:解压缩
[root@localhost ~]# tar zxf nginx-1.8.0.tar.gz
第三步:使用configure命令创建一makeFile文件。
./configure \
--prefix=/usr/local/nginx \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--with-http_gzip_static_module \
--http-client-body-temp-path=/var/temp/nginx/client \
--http-proxy-temp-path=/var/temp/nginx/proxy \
--http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
--http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
--http-scgi-temp-path=/var/temp/nginx/scgi
注意:启动nginx之前,上边将临时文件目录指定为/var/temp/nginx,需要在/var下创建temp及nginx目录
[root@localhost sbin]# mkdir /var/temp/nginx/client -p
第四步:make
第五步:make install
启动nginx
进入sbin目录
[root@localhost sbin]# cd /user/local/nginx/sbin/
[root@localhost sbin]# ./nginx
关闭nginx:
[root@localhost sbin]# ./nginx -s stop
推荐使用:
[root@localhost sbin]# ./nginx -s quit
重启nginx:
1、先关闭后启动。
2、刷新配置文件:
[root@localhost sbin]# ./nginx -s reload
查看进程:
[root@localhost sbin]# ps aux|grep nginx
master和worker进程都存在说明启动成功。
访问nginx
默认是80端口。
注意:是否关闭防火墙。
service iptables stop
下一篇:nginx虚拟主机配置。
- nginx安装及介绍(centos6.4)
- Centos6.6 安装jenkins及配置Nginx
- CentOS6.4_X64安装nginx
- Centos6.4上安装Nginx
- Centos6.4上安装Nginx
- nginx介绍及编译安装
- Nginx介绍及编译安装
- Nginx简单介绍及安装
- CentOS6.4上编译安装Nginx
- nginx 1.11.1在Centos6.4安装
- CentOS6.4下,Nginx安装与配置
- centos6.4下的Nginx安装
- linux centos6.5安装tengine(nginx)
- CentOS6编译安装Nginx
- centos6.5 nginx 安装
- centos6安装nginx
- centos6 nginx 安装PHP
- CentOS6.5 Nginx安装
- 三种方法重置 mysql 数据库自增ID
- ConcurrentHashMap理解
- org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry异常的解决方法
- C++ 库研究笔记——Linux下创建文件夹
- 15分钟破解网站验证码
- nginx安装及介绍(centos6.4)
- 转:sklearn中k折交叉验证函数使用
- Java练习(1)——选择排序
- jquery中几种事件绑定的方法比较
- 机考系统公式输入扫盲帖
- 泛化误差上界的证明,说明机器能进行学习和预测的基本原理。
- oracle12c修改字段长度报错:ORA-54033要修改的列由某个虚拟表达式使用
- 判断数值中是否包含某元素并删除
- leetcode— 3Sum