centos 6.5编译安装Nginx
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos 6.5编译安装Nginx相关的知识,希望对你有一定的参考价值。
epel源
[[email protected] ~]# yum -y install wget [[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
当前系统环境
[[email protected] ~]# cat /etc/redhat-release CentOS release 6.5 (Final) [[email protected] ~]# uname -r 2.6.32-431.el6.x86_64 [[email protected] ~]# uname -m x86_64
安装nginx所需要的pcre库
[[email protected] ~]# yum -y install pcre pcre-devel [[email protected] ~]# rpm -qa pcre pcre-devel pcre-devel-7.8-7.el6.x86_64 pcre-7.8-7.el6.x86_64
创建软件存放目录
[[email protected] ~]# mkdir -pv /usr/local/src mkdir: 已创建目录 "/usr/local/src" [[email protected] ~]# cd /usr/local/src/
下载软件
[[email protected] src]# wget http://nginx.org/download/nginx-1.10.3.tar.gz [[email protected] src]# ls -lh 总用量 892K -rw-r--r--. 1 root root 891K 1月 31 23:06 nginx-1.10.3.tar.gz
gcc编译器
[[email protected] nginx-1.10.3]# yum -y install gcc gcc-c++
安装openssl
[[email protected] nginx-1.10.3]# yum -y install openssl openssl-devel
创建nginx用户
[[email protected] nginx-1.10.3]# useradd nginx -s /sbin/nologin -M
解压
[[email protected] src]# tar xf nginx-1.10.3.tar.gz [[email protected] src]# cd nginx-1.10.3 [[email protected] nginx-1.10.3]# ls auto CHANGES CHANGES.ru conf configure contrib html LICENSE man README src
配置、编译、安装
[[email protected] nginx-1.10.3]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module [[email protected] nginx-1.10.3]# echo $? 0 [[email protected] nginx-1.10.3]# make && make install
启动服务
[[email protected] nginx-1.10.3]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [[email protected] nginx-1.10.3]# /usr/local/nginx/sbin/nginx [[email protected] nginx-1.10.3]# netstat -nlput | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3782/nginx [[email protected] nginx-1.10.3]# lsof -i :80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 3782 root 6u IPv4 18905 0t0 TCP *:http (LISTEN) nginx 3783 nginx 6u IPv4 18905 0t0 TCP *:http (LISTEN)
验证
浏览器访问或linux curl
本文出自 “十里春风” 博客,请务必保留此出处http://visitor.blog.51cto.com/11247238/1952392
以上是关于centos 6.5编译安装Nginx的主要内容,如果未能解决你的问题,请参考以下文章