linux环境下nginx安装

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值