CentOS7.0系统中9大步骤离线安装nginx-1.12.2版本【配套安装包网盘拉取即可】

笔记大纲
  • 解压安装pcre、openssl、zlib、nginx包
  • 关闭防火墙
  • 启动nginx
  • CentOS7.0内置浏览器测试
  • nginx开放端口
  • Window访问Linux上nginx
  • nginx常用命令

☛林大侠网盘链接下载一Nginx安装包

链接:https://pan.baidu.com/s/1KU_Sqy4Po2I_gtR9EIko0g
提取码:07g5

四大安装包

CentOS7.0上成功安装好Tomcat、JDK.

  • pcre-8.37.tar.gz
  • openssl-1.0.1t.tar.gz
  • zlib-1.2.8.tar.gz
  • nginx-1.12.2.tar.gz
一、解压安装pcre包

tar -zxvf pcre-xx.tar.gz //解压命令

(1)解压缩pcre-xx.tar.gz

(2)进入解压缩目录,执行./configure

(3)如果提示,需要提前安装gcc++,进入安装光盘目录的软件包(/media/CentOSXX/Package)执行

rpm -ivh libstdc++-devel-4.4.7-17.el6.x86_64.rpm

rpm -ivh gcc-c++-4.4.7-17.el6.x86_64.rpm

(4)./configure完成后,回到pcre目录下执行make,再执行make install

make && make install  //组合命令 
二、解压安装openssl包

(1)解压缩openssl-xx.tar.gz

(2)进入解压缩目录,执行./config

(3)make && make install

三、解压安装zlib包

(1) 解压缩zlib-xx.tar.gz

(2)进入解压缩目录,执行./configure

(3) make && make install

四、解压安装nginx包

(1) 解压缩nginx-xx.tar.gz

(2) 进入解压缩目录,执行./configure

(3)make && make install,默认安装目录/usr/local/nginx

五、关闭防火墙
systemctl stop firewalld //关闭防火墙
systemctl status firewalld //查看防火墙状态
六、启动nginx
七、CentOS7.0内置浏览器测试
八、nginx开放端口

windows系统中访问linuxnginx,默认不能访问的,因为防火墙问题,在windows系统中访问linuxnginx,默认不能访问的,因为防火墙问题!

注意以下命令,需要开启linux的防火墙!

(1) 查看开放的端口号

firewall-cmd --list-all

(2)设置开放的端口号

firewall-cmd --add-service=http --permanent

firewall-cmd --add-port=80/tcp --permanent  //自行开放需要的端口号

(3)重启防火墙sys【开放的端口号才会生效】

firewall-cmd --reload

执行代码

[root@localhost sbin]# firewall-cmd --list-all   //查看开放的端口号,防火墙需要开放
FirewallD is not running 
[root@localhost sbin]# systemctl status firewalld  //查看防火墙的状态
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Nov 04 18:58:02 localhost.localdomain firewalld[29607]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Nov 04 18:59:11 localhost.localdomain firewalld[29607]: WARNING: ALREADY_ENABLED: http
Nov 04 19:02:36 localhost.localdomain firewalld[29607]: WARNING: ICMP type 'beyond-scope' is not supported by the kernel for ipv6.
Nov 04 19:02:36 localhost.localdomain firewalld[29607]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Nov 04 19:02:36 localhost.localdomain firewalld[29607]: WARNING: ICMP type 'failed-policy' is not supported by the kernel for ipv6.
Nov 04 19:02:36 localhost.localdomain firewalld[29607]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Nov 04 19:02:36 localhost.localdomain firewalld[29607]: WARNING: ICMP type 'reject-route' is not supported by the kernel for ipv6.
Nov 04 19:02:36 localhost.localdomain firewalld[29607]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type., ignoring for run-time.
Nov 04 19:04:04 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 04 19:04:05 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@localhost sbin]# systemctl start firewalld  //开启防火墙
   
[root@localhost sbin]# firewall-cmd --list-all   //再次查看开放的端口号
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: ssh dhcpv6-client http
  ports: 80/tcp 8080/tcp 8081/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
	
[root@localhost sbin]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources: 
  services: ssh dhcpv6-client http
  ports: 80/tcp 8080/tcp 8081/tcp  //我开放了80、8080、8081三个端口
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
九、Window访问Linux上nginx
nginx常用命令

(1)查看nginx进程

[root@localhost sbin]# ps -ef|grep nginx   //查看nginx进程
root      16197      1  0 14:53 ?        00:00:00 nginx: master process ./nginx
nobody    16198  16197  0 14:53 ?        00:00:00 nginx: worker process
root      16202  15560  0 14:53 pts/0    00:00:00 grep --color=auto nginx

(2)停止nginx服务

[root@localhost sbin]# ./nginx -s stop
[root@localhost sbin]# ps -ef|grep nginx 
root      16231  15560  0 14:55 pts/0    00:00:00 grep --color=auto nginx

(3)重启nginx服务

[root@localhost sbin]# ./nginx -s reload

(4)查看nginx版本

[root@localhost sbin]# ./nginx -v
nginx version: nginx/1.12.2
安装成功!!!

 ☝上述分享来源个人总结,如果分享对您有帮忙,希望您积极转载;如果您有不同的见解,希望您积极留言,让我们一起探讨,您的鼓励将是我前进道路上一份助力,非常感谢!我会不定时更新相关技术动态,同时我也会不断完善自己,提升技术,希望与君同成长同进步!

☞本人博客:https://coding0110lin.blog.csdn.net/  欢迎转载,一起技术交流吧!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值