反向代理---nginx
1. 安装mysql
https://www.cnblogs.com/tony-hyn/p/15777762.html
远程连接mysql服务器时,无法连接.===防火墙是否把3306端口放行。
查看防火墙放行的端口号:firewall-cmd --list-port
添加放行的端口号: firewall-cmd --add-port=3306/tcp --zone=public --permanent
并重启防火墙:systemctl restart firewalld
移除防火墙的端口号: firewall-cmd --remove-port=3306/tcp --zone=public --permanent
关闭防火墙 :systemctl stop firewalld
禁用防火墙: systemctl disable firewalld
2. Nat和桥接网络的区别
NAT模式的网络: 就是使用虚拟机虚拟一个网卡,该网络只允许本机访问。
桥接模式的网络: 它的ip和当前window主机的IP是一个网段。
安装一个桥接网络的虚拟机---而且配置好固定ip
3. 反向代理服务器: nginx
3.1 什么是nginx
Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器 . 其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好。 能够支持高达 50,000 个并发连接数的响应 .
3.2 为什么使用nginx.

3.3 哪些企业在使用nginx反向代理服务器
京东,淘宝,腾讯都在使用nginx代理服务器
3.4 如何安装nginx
(1)安装相关的依赖
yum install -y gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
(2)上传nginx并解压
tar -zxvf xxx.tar.gz

(3)创建一个目录---作为nginx的安装路径
mkdir /usr/nginx
(4)进入到nginx的解压目录并指定nginx的安装路径为上面的路径
./configure --prefix=/usr/nginx

(5)编译nginx的源码并安装
make 编译
make install 安装
(6)进入安装路径 /usr/nginx

conf: nginx的配置目录
html:静态资源
logs: 日志
sbin: 脚本---启动 关闭 重加载
(7)启动nginx
./nginx 启动nginx
./nginx -s stop 关闭nginx
./nginx -s reload 重新加载配置文件
通过ps -ef | grep nginx命令查看进程
(8)访问nginx

3.5 了解nginx的配置文件



自定义一个server配置
server {
listen 81;
server_name localhost;
location / {
root static;
index xyh.html;
}
}
重新加载配置文件(切记)
/usr/nginx/sbin/nginx -s reload

浙公网安备 33010602011771号