1、准备工作

1 )打开虚拟机,使用远程连接工具连接 linux 操作系统
2 )到 nginx 官网下载软件
http://nginx.org/
 

2、开始进行 nginx 安装

1 )安装 pcre 依赖
第一步 联网下载 pcre 压缩文件依赖
wget http://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gz
 
Nginx 的安装
 
第二步 解压压缩文件
使用命令 tar –xvf pcre-8.37.tar.gz
第三步 ./configure 完成后,回到 pcre 目录下执行 make ,最后执行 make install
Nginx 的安装
安装之后,使用命令,查看版本号 pcre-config --version
Nginx 的安装
 
2 )安装 openssl zlib gcc 依赖
yum -y install make zlib zlib-devel gcc-c++ libtool openssl openssl-devel
Nginx 的安装
第四步,安装 nginx
1 、 解压缩 nginx-xx.tar.gz 包。
2 、 进入解压缩目录,执行 ./configure
3 make && make install
 
进入目录 /usr/local/nginx/sbin/nginx 启动服务
 
查看开放的端口号
Nginx 的安装
firewall-cmd --list-all
设置开放的端口号
firewall-cmd --add-service=http –permanent
sudo firewall-cmd --add-port=80/tcp --permanent
Nginx 的安装
 
重启防火墙
systemctl status firewalld
Nginx 的安装
 
nginx连接成功如下:
 
Nginx 的安装
 
 

 一、防火墙的开启、关闭、禁用命令

(1)设置开机启用防火墙:systemctl enable firewalld.service

(2)设置开机禁用防火墙:systemctl disable firewalld.service

(3)启动防火墙:systemctl start firewalld

(4)关闭防火墙:systemctl stop firewalld

(5)检查防火墙状态:systemctl status firewalld 

二、使用firewall-cmd配置端口

(1)查看防火墙状态:firewall-cmd --state

(2)重新加载配置:firewall-cmd --reload

(3)查看开放的端口:firewall-cmd --list-ports

(4)开启防火墙端口:firewall-cmd --zone=public --add-port=9200/tcp --permanent

 

 

 

相关文章:

  • 2021-10-20
  • 2022-01-21
  • 2022-12-23
  • 2021-09-09
猜你喜欢
  • 2021-12-06
  • 2021-07-20
相关资源
相似解决方案