如何在CentOS7上面编译安装Nginx,快速实现你的负载均衡?

如何在CentOS7上面编译安装Nginx,快速实现你的负载均衡?

[root@haoding-jq1 ~]# cd /home/haoding/
[root@haoding-jq1 haoding]# cd hd205/
[root@haoding-jq1 hd205]# ll
总用量 7796
-rw-rw-r– 1 haoding haoding 120553 9月 13 11:28 1.2.6.tar.gz
-rw-rw-r– 1 haoding haoding 832104 9月 13 11:28 nginx-1.8.0.tar.gz
-rw-rw-r– 1 haoding haoding 167495 9月 13 11:28 nginx_upstream_check_module-master.zip
-rw-rw-r– 1 haoding haoding 4509047 9月 13 11:28 openssl-1.0.1g.tar.gz
-rw-rw-r– 1 haoding haoding 2053336 9月 13 11:28 pcre-8.38.tar.gz
[root@haoding-jq1 hd205]# pwd
/home/haoding/hd205
[root@haoding-jq1 hd205]# ll
总用量 7796
-rw-rw-r– 1 haoding haoding 120553 9月 13 11:28 1.2.6.tar.gz
-rw-rw-r– 1 haoding haoding 832104 9月 13 11:28 nginx-1.8.0.tar.gz
-rw-rw-r– 1 haoding haoding 167495 9月 13 11:28 nginx_upstream_check_module-master.zip
-rw-rw-r– 1 haoding haoding 4509047 9月 13 11:28 openssl-1.0.1g.tar.gz
-rw-rw-r– 1 haoding haoding 2053336 9月 13 11:28 pcre-8.38.tar.gz
[root@haoding-jq1 hd205]# cp openssl-1.0.1g.tar.gz /usr/local/src/
[root@haoding-jq1 hd205]# ll
总用量 7796
-rw-rw-r– 1 haoding haoding 120553 9月 13 11:28 1.2.6.tar.gz
-rw-rw-r– 1 haoding haoding 832104 9月 13 11:28 nginx-1.8.0.tar.gz
-rw-rw-r– 1 haoding haoding 167495 9月 13 11:28 nginx_upstream_check_module-master.zip
-rw-rw-r– 1 haoding haoding 4509047 9月 13 11:28 openssl-1.0.1g.tar.gz
-rw-rw-r– 1 haoding haoding 2053336 9月 13 11:28 pcre-8.38.tar.gz
[root@haoding-jq1 hd205]# cp pcre-8.38.tar.gz /usr/local/src/
[root@haoding-jq1 hd205]# cp nginx-1.8.0.tar.gz /usr/local/src/
[root@haoding-jq1 hd205]# cp 1.2.6.tar.gz /usr/local/src/
[root@haoding-jq1 hd205]# cp nginx_upstream_check_module-master.zip /usr/local/src/
[root@haoding-jq1 hd205]#
[root@haoding-jq1 src]# history 20
234 ll
235 cp pcre-8.38.tar.gz /usr/local/src/
236 cp nginx-1.8.0.tar.gz /usr/local/src/
237 cp 1.2.6.tar.gz /usr/local/src/
238 cp nginx_upstream_check_module-master.zip /usr/local/src/
239 cd /usr/local/src/
240 pwd
241 ll
242 gzip -cdf nginx-1.8.0.tar.gz | tar -xvf -
243 ll
244 gzip -cdf openssl-1.0.1g.tar.gz | tar -xvf -
245 ll
246 gzip -cdf pcre-8.38.tar.gz | tar -xvf -
247 ll
248 unzip nginx_upstream_check_module-master.zip
249 ll
250 gzip -cdf 1.2.6.tar.gz | tar -xvf -
——————————->
开始:
1. nginx安装

cd nginx-1.8.0

加入skicty模块
./configure –prefix=/usr/local/nginx –with-http_ssl_module –with-openssl=/usr/local/src/openssl-1.0.1g –with-pcre=/usr/local/src/pcre-8.38 –add-module=/usr/local/src/nginx_upstream_check_module-master/ –with-http_stub_status_module –with-http_realip_module –add-module=/usr/local/src/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/

Make
Make install
———————————->
————————->
[root@haoding-jq1 nginx-1.8.0]# cd /usr/local/nginx/
[root@haoding-jq1 nginx]# cd sbin/
[root@haoding-jq1 sbin]# ./nginx -V
nginx version: nginx/1.8.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
built with OpenSSL 1.0.1g 7 Apr 2014
TLS SNI support enabled
configure arguments: –prefix=/usr/local/nginx –with-http_ssl_module –with-openssl=/usr/local/src/openssl-1.0.1g –with-pcre=/usr/local/src/pcre-8.38 –add-module=/usr/local/src/nginx_upstream_check_module-master/ –with-http_stub_status_module –with-http_realip_module –add-module=/usr/local/src/nginx-goodies-nginx-sticky-module-ng-c78b7dd79d0d/

[root@haoding-jq1 sbin]# ps -ef|grep nginx
root 24333 2130 0 16:19 pts/0 00:00:00 grep –color=auto nginx
[root@haoding-jq1 sbin]# cd ../conf/
[root@haoding-jq1 conf]# ll
总用量 60
-rw-r–r– 1 root root 1034 9月 13 16:14 fastcgi.conf
-rw-r–r– 1 root root 1034 9月 13 16:14 fastcgi.conf.default
-rw-r–r– 1 root root 964 9月 13 16:14 fastcgi_params
-rw-r–r– 1 root root 964 9月 13 16:14 fastcgi_params.default
-rw-r–r– 1 root root 2837 9月 13 16:14 koi-utf
-rw-r–r– 1 root root 2223 9月 13 16:14 koi-win
-rw-r–r– 1 root root 3957 9月 13 16:14 mime.types
-rw-r–r– 1 root root 3957 9月 13 16:14 mime.types.default
-rw-r–r– 1 root root 2656 9月 13 16:14 nginx.conf
-rw-r–r– 1 root root 2656 9月 13 16:14 nginx.conf.default
-rw-r–r– 1 root root 596 9月 13 16:14 scgi_params
-rw-r–r– 1 root root 596 9月 13 16:14 scgi_params.default
-rw-r–r– 1 root root 623 9月 13 16:14 uwsgi_params
-rw-r–r– 1 root root 623 9月 13 16:14 uwsgi_params.default
-rw-r–r– 1 root root 3610 9月 13 16:14 win-utf
[root@haoding-jq1 conf]# vim nginx.conf
[root@haoding-jq1 conf]# cd ../sbin/
[root@haoding-jq1 sbin]# ./nginx
[root@haoding-jq1 sbin]# ps -ef|grep nginx
root 24337 1 0 16:19 ? 00:00:00 nginx: master process ./nginx
nobody 24338 24337 0 16:19 ? 00:00:00 nginx: worker process
root 24340 2130 0 16:19 pts/0 00:00:00 grep –color=auto nginx

[root@haoding-jq1 sbin]#
[root@haoding-jq1 sbin]# curl http://localhost:80



Welcome to nginx!

body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}


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.



[root@haoding-jq1 sbin]#

上述NGINX安装包获取路径如下:
网盘下载地址:
https://pan.baidu.com/s/1_w13HKDXV4sbYoK56dwLLg
这里写图片描述

我是昊鼎王五,我为自己带盐,有兴趣的朋友们可以扫码关注公众号,更多惊喜等待着你哦
这里写图片描述

猜你喜欢

转载自blog.csdn.net/haoding205/article/details/81236506