centos7安装nginx的两种方法介绍

2019-10-12 14:22:44于丽

CentOS防火墙的关闭,关闭其服务即可:

查看CentOS防火墙信息:/etc/init.d/iptables status

关闭CentOS防火墙服务:/etc/init.d/iptables stop

永久关闭防火墙: chkconfig –level 35 iptables off

如果是centos7

[root@rhel7 ~]# systemctl status firewalld.service

[root@rhel7 ~]# systemctl stop firewalld.service

[root@rhel7 ~]# systemctl disable firewalld.service

[root@rhel7 ~]# systemctl status firewalld.service

扩展知识:

启动一个服务:systemctl start firewalld.service

关闭一个服务:systemctl stop firewalld.service

重启一个服务:systemctl restart firewalld.service

显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?

查看已启动的服务列表:systemctl list-unit-files|grep enabled

第二种方式:通过手动下载安装包解压安装

1.下载nginx包。

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

2.复制包到你的安装目录

[root@localhost ~]# cp nginx-1.10.1.tar.gz /usr/local/

3.解压

[root@localhost ~]# tar -zxvf nginx-1.10.1.tar.gz
[root@localhost ~]# cd nginx-1.10.1

4.启动nginx

[root@localhost ~]# /usr/local/nginx/sbin/nginx

5.查看版本s

[root@localhost ~]# nginx -v

6.url访问nginx localhost或127.0.0.1

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易采站长站。