小言_互联网的博客

linux环境下nginx安装

326人阅读  评论(0)

1.下载nginx
nginx下载地址:http://nginx.org/en/download.html
下载nginx

[root@localhost ~]# wget http://nginx.org/download/nginx-1.14.2.tar.gz

2.nginx会有几个依赖包,我们首先安装依赖,不要安装过程中会报错

[root@localhost ~]# yum  -y install zlib-devel pcre-devel openssl-devel

3.解压压缩包

[root@localhost ~]# ls
anaconda-ks.cfg  mysql-5.7.21-linux-glibc2.12-x86_64  mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz  nginx  nginx-1.14.2.tar.gz  yl_wechat_dev_0917.sql
[root@localhost ~]# tar -zxvf nginx-1.14.2.tar.gz 

4.进入安装包目录
检查安装

[root@localhost nginx-1.14.2]#  ./configure --prefix=/usr/local/nginx --with-openssl=/usr/include/openssl --with-pcre --with-http_ssl_module --with-http_gzip_static_module 

或者

[root@localhost nginx-1.14.2]#  ./configure --prefix=/usr/local/nginx --with-pcre --with-http_ssl_module --with-http_gzip_static_module 

5.如果检查条件中依赖包没有安装,安装依赖包之后则需要执行

[root@localhost nginx-1.14.2]# rm -rf Makefile

6.检查安装条件正常之后执行

[root@localhost nginx-1.14.2]# make 
[root@localhost nginx-1.14.2]# make install

7.安装成功之后启动

[root@localhost nginx-1.14.2]# /usr/local/nginx/sbin/nginx

8.查看是否启动成功

[root@localhost nginx-1.14.2]# ps -ef|grep nginx
root       3264   3249  0 Sep24 ?        00:00:00 nginx: master process nginx -g daemon off;
101        3292   3264  0 Sep24 ?        00:00:00 nginx: worker process
root       3346   3332  0 Sep24 ?        00:00:00 nginx: master process nginx -g daemon off;
101        3373   3346  0 Sep24 ?        00:00:00 nginx: worker process
root      57440  57424  0 00:03 ?        00:00:00 nginx: master process nginx -g daemon off;
101       57468  57440  0 00:03 ?        00:00:00 nginx: worker process
root      57700  57686  0 00:04 ?        00:00:00 nginx: master process nginx -g daemon off;
101       57724  57700  0 00:04 ?        00:00:00 nginx: worker process
root      73218      1  0 04:27 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody    73219  73218  0 04:27 ?        00:00:00 nginx: worker process
root      73251   1982  0 04:28 pts/0    00:00:00 grep --color=auto nginx

转载:https://blog.csdn.net/yinjinshui/article/details/101371437
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场