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
时间: 2024-10-08 08:47:39