centos 6.5編譯安裝Nginx

epel源

[root@www ~]# yum -y install wget   
[root@www ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
  • 當前系統環境

[root@www ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@www ~]# uname -r
2.6.32-431.el6.x86_64
[root@www ~]# uname -m
x86_64
  • 安裝Nginx所需要的pcre庫

[root@www ~]# yum -y install pcre pcre-devel
[root@www ~]# rpm -qa pcre pcre-devel
pcre-devel-7.8-7.el6.x86_64
pcre-7.8-7.el6.x86_64
  • 創建軟件存放目錄

[root@www ~]# mkdir -pv /usr/local/src
mkdir: 已創建目錄 "/usr/local/src"
[root@www ~]# cd /usr/local/src/
  • 下載軟件

[root@www src]# wget http://nginx.org/download/nginx-1.10.3.tar.gz
[root@www src]# ls -lh
總用量 892K
-rw-r--r--. 1 root root 891K 1月  31 23:06 nginx-1.10.3.tar.gz
  • gcc編譯器

[root@www nginx-1.10.3]# yum -y install gcc gcc-c++
  • 安裝openssl

[root@www nginx-1.10.3]# yum -y install openssl openssl-devel
  • 創建nginx用戶

[root@www nginx-1.10.3]# useradd nginx -s /sbin/nologin -M
  • 解壓

[root@www src]# tar xf nginx-1.10.3.tar.gz
[root@www src]# cd nginx-1.10.3
[root@www nginx-1.10.3]# ls
auto  CHANGES  CHANGES.ru  conf  configure  contrib  html  LICENSE  man  README  src
  • 配置、編譯、安裝

[root@www nginx-1.10.3]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
[root@www nginx-1.10.3]# echo $?
0
[root@www nginx-1.10.3]# make && make install
  • 啓動服務

[root@www 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
[root@www nginx-1.10.3]# /usr/local/nginx/sbin/nginx
[root@www nginx-1.10.3]# netstat -nlput | grep nginx
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      3782/nginx
[root@www 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

wKioL1l-6DfRt5cmAABJMWPCFCw229.png-wh_50

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章