设计师喜欢的购物网站有没有做图的网站

当前位置: 首页 > news >正文

设计师喜欢的购物网站,有没有做图的网站,太原seo推广外包,百度我的订单一、Nginx反向代理#xff08;七层代理#xff09; 实验要求 使用Nginx实现Web反向代理功能#xff0c;实现如下功能#xff1a; 后端Web服务器两台#xff0c;可以使用httpd实现Nginx采用轮询的方式调用后端Web服务器两台Web服务器的权重要求设置为不同的值最大失败次数为…一、Nginx反向代理七层代理 实验要求 使用Nginx实现Web反向代理功能实现如下功能 后端Web服务器两台可以使用httpd实现Nginx采用轮询的方式调用后端Web服务器两台Web服务器的权重要求设置为不同的值最大失败次数为2失败超时时间为30秒 实验环境 以下机器全部已经存在无须再次配置主机名 IP地址 角色 server1已存在 eth0192.168.99.25424 客户端 proxy已存在 eth1192.168.99.524 代理服务器 web1已存在 eth1192.168.99.10024 web服务器 web2已存在 eth1192.168.99.20024 web服务器 image-202410082130582811部署后端Web服务器 1部署后端Web1服务器 后端Web服务器可以简单使用yum方式安装httpd实现Web服务为了可以看出后端服务器的不同可以将两台后端服务器的首页文档内容设置为不同的内容 [rootweb1 ~]# yum -y install httpd [rootweb1 ~]# echo web1 /var/www/html/index.html [rootweb1 ~]# systemctl enable –now httpd2部署后端Web2服务器 [rootweb2 ~]# yum -y install httpd [rootweb2 ~]# echo web2 /var/www/html/index.html [rootweb2 ~]# systemctl enable –now httpd3使用proxy主机测试 [rootproxy ~]# curl 192.168.99.100 web1 [rootproxy ~]# curl 192.168.99.200 web2 2配置Nginx代理服务器 添加服务器池实现反向代理功能之前proxy主机安装的nginx已经改过很多配置避免实验冲突先还原proxy主机的nginx重新安装nginx [rootproxy ~]# /usr/local/nginx/sbin/nginx -s stop #如果之前没有启动可以不用执行停止的命令 [rootproxy ~]# rm -rf /usr/local/nginx/ [rootproxy ~]# cd /root/lnmp_soft/ [rootproxy lnmp_soft]# rm -rf nginx-1.22.1 [rootproxy lnmp_soft]# tar -xf nginx-1.22.1.tar.gz [rootproxy lnmp_soft]# cd nginx-1.22.1/ [rootproxy nginx-1.22.1]# yum -y install gcc make pcre-devel openssl-devel [rootproxy nginx-1.22.1]# ./configure [rootproxy nginx-1.22.1]# make make install 1修改nginx的配置文件 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf … http { … #使用upstream定义后端服务器集群集群名称任意(如webserver) #使用server定义集群中的具体服务器和端口upstream webserver {server 192.168.99.100:80;server 192.168.99.200:80;}server {listen 80;server_name localhost;#charset koi8-r;#access_log logs/host.access.log main;location / {root html;index index.html index.htm;proxy_pass http://webserver; #通过proxy_pass将用户的请求转发给webserver集群}…2启动nginx [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx3使用真机浏览器做测试192.168.99.5刷新可以看到网站的轮询效果出现结果为 web1 或者 web2 3配置upstream服务器集群池属性 1设置权重 weight可以设置后台服务器的权重权重越大任务的分配量就越大 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf .. ..upstream webserver {server 192.168.99.100:80 weight2;server 192.168.99.200:80;}server {.. ..2重新加载配置并访问可以看到web1的任务量增加 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload真机浏览器测试http://192.168.99.5不太明显 可以使用命令行测试 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web2 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web13设置健康检查max_fails可以设置后台服务器连不上的失败次数fail_timeout可以设置后台服务器的失败超时时间等待多长时间再次尝试连接 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf …upstream webserver {server 192.168.99.100:80;server 192.168.99.200:80 max_fails2 fail_timeout30;}server {…4重新加载配置并访问 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload测试时先将web2的httpd服务关闭 [rootweb2 ~]# systemctl stop httpd使用真机命令行访问集群页面curl 192.168.99.5只会显示web1的页面 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web1此时即使将web2的httpd服务开启也无效因为要等待30秒 [rootweb2 ~]# systemctl start httpd [rootserver1 ~]# curl 192.168.99.5 #30秒之后再访问web2会出现 web2 4配置upstream服务器集群的调度算法 测试ip_hash 1设置相同客户端访问相同Web服务器 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf …upstream webserver {ip_hash;server 192.168.99.100:80;server 192.168.99.200:80;}server { … 2重新加载配置 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload3测试只会见到一个页面 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web1 添加down标记 down标记可以让集群主机暂时不参与集群活动 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf …upstream webserver {server 192.168.99.100:80;server 192.168.99.200:80 down;}server {… 重新加载配置 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload测试只会见到web1 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web1二、Nginx的TCP/UDP调度器四层代理实验要求 使用Nginx实现TCP/UDP调度器功能实现如下功能 后端SSH服务器两台Nginx编译安装时需要使用–with-stream开启ngx_stream_core_module模块Nginx采用轮询的方式调用后端SSH服务器 实验环境 以下机器全部已经存在无须再次配置主机名 IP地址 角色 server1已存在 eth0192.168.99.25424 客户端 proxy已存在 eth1192.168.99.524 代理服务器 web1已存在 eth1192.168.99.10024 ssh服务器 web2已存在 eth1192.168.99.20024 ssh服务器 image-202410082133113331部署nginx服务 支持4层TCP/UDP代理的Nginx服务器 1部署nginx服务器 编译安装必须要使用–with-stream参数开启4层代理模块 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s stop [rootproxy nginx-1.22.1]# rm -rf /usr/local/nginx/ [rootproxy nginx-1.22.1]# cd /root/lnmp_soft/nginx-1.22.1/ [rootproxy nginx-1.22.1]# yum -y install gcc make pcre-devel openssl-devel [rootproxy nginx-1.22.1]# ./configure –with-stream #开启4层代理功能 [rootproxy nginx-1.22.1]# make make install [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -V #查看安装模块情况 nginx version: nginx/1.22.1 built by gcc 8.5.0 20210514 (Red Hat 8.5.0-10) (GCC) configure arguments: –with-stream 2配置Nginx服务 添加服务器池实现四层代理功能1修改nginx配置文件[rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf #配置写到http的上方即可 …stream {upstream backend { #创建集群名称为backendserver 192.168.99.100:22; #后端SSH服务器IP和端口server 192.168.99.200:22;}server { #调用集群listen 12345; #Nginx代理监听的端口可以自己定义proxy_pass backend; #调用backend集群}} http { .. .. } 2启动nginx [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx 3客户端使用访问代理服务器测试轮询效果 [rootserver1 ~]# ssh 192.168.99.5 -p 12345 #使用该命令多次访问查看轮询效果 [rootweb1 ~]# exit [rootserver1 ~]# ssh 192.168.99.5 -p 12345 [rootweb2 ~]# 一、Nginx反向代理七层代理 实验要求 使用Nginx实现Web反向代理功能实现如下功能      后端Web服务器两台可以使用httpd实现     Nginx采用轮询的方式调用后端Web服务器     两台Web服务器的权重要求设置为不同的值     最大失败次数为2失败超时时间为30秒 实验环境 以下机器全部已经存在无须再次配置 主机名    IP地址    角色 server1已存在    eth0192.168.99.254/24    客户端 proxy已存在    eth1192.168.99.5/24    代理服务器 web1已存在    eth1192.168.99.100/24    web服务器 web2已存在    eth1192.168.99.200/24    web服务器 image-20241008213058281 1部署后端Web服务器 1部署后端Web1服务器 后端Web服务器可以简单使用yum方式安装httpd实现Web服务为了可以看出后端服务器的不同可以将两台后端服务器的首页文档内容设置为不同的内容 [rootweb1 ~]# yum -y install httpd [rootweb1 ~]# echo web1 /var/www/html/index.html [rootweb1 ~]# systemctl enable –now httpd 2部署后端Web2服务器 [rootweb2 ~]# yum -y install  httpd [rootweb2 ~]# echo web2 /var/www/html/index.html [rootweb2 ~]# systemctl enable –now httpd 3使用proxy主机测试 [rootproxy ~]# curl 192.168.99.100 web1 [rootproxy ~]# curl 192.168.99.200 web2 2配置Nginx代理服务器 添加服务器池实现反向代理功能 之前proxy主机安装的nginx已经改过很多配置避免实验冲突先还原proxy主机的nginx重新安装nginx [rootproxy ~]# /usr/local/nginx/sbin/nginx  -s stop    #如果之前没有启动可以不用执行停止的命令 [rootproxy ~]# rm -rf /usr/local/nginx/ [rootproxy ~]# cd /root/lnmp_soft/ [rootproxy lnmp_soft]# rm -rf nginx-1.22.1 [rootproxy lnmp_soft]# tar -xf nginx-1.22.1.tar.gz [rootproxy lnmp_soft]# cd nginx-1.22.1/ [rootproxy nginx-1.22.1]# yum -y install gcc make pcre-devel openssl-devel [rootproxy nginx-1.22.1]# ./configure  [rootproxy nginx-1.22.1]# make make  install     1修改nginx的配置文件 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf … http { … #使用upstream定义后端服务器集群集群名称任意(如webserver) #使用server定义集群中的具体服务器和端口       upstream webserver {          server 192.168.99.100:80;          server 192.168.99.200:80;         }       server {           listen       80;           server_name  localhost;                      #charset koi8-r;                      #access_log  logs/host.access.log  main;              location / {               root   html;               index  index.html index.htm;               proxy_pass http://webserver;  #通过proxy_pass将用户的请求转发给webserver集群           }  …   2启动nginx [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx 3使用真机浏览器做测试192.168.99.5刷新可以看到网站的轮询效果出现结果为 web1 或者 web2 3配置upstream服务器集群池属性 1设置权重 weight可以设置后台服务器的权重权重越大任务的分配量就越大 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf .. ..       upstream webserver {          server 192.168.99.100:80 weight2;          server 192.168.99.200:80;         }       server {  .. .. 2重新加载配置并访问可以看到web1的任务量增加 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload 真机浏览器测试http://192.168.99.5不太明显 可以使用命令行测试 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web2 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web1 3设置健康检查max_fails可以设置后台服务器连不上的失败次数fail_timeout可以设置后台服务器的失败超时时间等待多长时间再次尝试连接 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf …       upstream webserver {          server 192.168.99.100:80;          server 192.168.99.200:80 max_fails2 fail_timeout30;         }       server {  … 4重新加载配置并访问 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload 测试时先将web2的httpd服务关闭 [rootweb2 ~]# systemctl stop  httpd 使用真机命令行访问集群页面curl 192.168.99.5只会显示web1的页面 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web1 此时即使将web2的httpd服务开启也无效因为要等待30秒 [rootweb2 ~]# systemctl start  httpd [rootserver1 ~]# curl 192.168.99.5 #30秒之后再访问web2会出现 web2 4配置upstream服务器集群的调度算法 测试ip_hash 1设置相同客户端访问相同Web服务器 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf …       upstream webserver {          ip_hash;          server 192.168.99.100:80;          server 192.168.99.200:80;         }       server { … 2重新加载配置 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload 3测试只会见到一个页面 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web1 添加down标记 down标记可以让集群主机暂时不参与集群活动 [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf …       upstream webserver {          server 192.168.99.100:80;          server 192.168.99.200:80 down;         }       server {  … 重新加载配置 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s reload 测试只会见到web1 [rootserver1 ~]# curl 192.168.99.5 web1 [rootserver1 ~]# curl 192.168.99.5 web1 二、Nginx的TCP/UDP调度器四层代理 实验要求 使用Nginx实现TCP/UDP调度器功能实现如下功能      后端SSH服务器两台     Nginx编译安装时需要使用–with-stream开启ngx_stream_core_module模块     Nginx采用轮询的方式调用后端SSH服务器 实验环境 以下机器全部已经存在无须再次配置 主机名    IP地址    角色 server1已存在    eth0192.168.99.254/24    客户端 proxy已存在    eth1192.168.99.5/24    代理服务器 web1已存在    eth1192.168.99.100/24    ssh服务器 web2已存在    eth1192.168.99.200/24    ssh服务器 image-20241008213311333 1部署nginx服务 支持4层TCP/UDP代理的Nginx服务器  1部署nginx服务器 编译安装必须要使用–with-stream参数开启4层代理模块 [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -s stop [rootproxy nginx-1.22.1]# rm -rf /usr/local/nginx/ [rootproxy nginx-1.22.1]# cd /root/lnmp_soft/nginx-1.22.1/ [rootproxy nginx-1.22.1]# yum -y install gcc make pcre-devel openssl-devel [rootproxy nginx-1.22.1]# ./configure –with-stream                    #开启4层代理功能 [rootproxy nginx-1.22.1]# make make install [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx -V           #查看安装模块情况 nginx version: nginx/1.22.1 built by gcc 8.5.0 20210514 (Red Hat 8.5.0-10) (GCC)  configure arguments: –with-stream 2配置Nginx服务 添加服务器池实现四层代理功能 1修改nginx配置文件  [rootproxy nginx-1.22.1]# vim /usr/local/nginx/conf/nginx.conf    #配置写到http的上方即可 …       stream {         upstream backend {             #创建集群名称为backend             server 192.168.99.100:22;  #后端SSH服务器IP和端口             server 192.168.99.200:22;           }          server {               #调用集群             listen 12345;       #Nginx代理监听的端口可以自己定义             proxy_pass backend; #调用backend集群           }      } http { .. .. } 2启动nginx [rootproxy nginx-1.22.1]# /usr/local/nginx/sbin/nginx  3客户端使用访问代理服务器测试轮询效果 [rootserver1 ~]# ssh 192.168.99.5 -p 12345     #使用该命令多次访问查看轮询效果 [rootweb1 ~]# exit [rootserver1 ~]# ssh 192.168.99.5 -p 12345 [rootweb2 ~]#