<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      【代理是什么?】nginx快速入門+反向代理hexo個(gè)人博客

      @

      前言


      • 什么是nginx?
        Nginx是一款輕量級(jí)的Web 服務(wù)器/反向代理服務(wù)器及電子郵件(IMAP/POP3)代理服務(wù)器。特點(diǎn)是占有內(nèi)存少,并發(fā)能力特別強(qiáng)。

      • nginx作用?
        http代理,如:正向代理、反向代理

      本文說明 請(qǐng)大家務(wù)必查看


      本文有兩個(gè)版本,詳細(xì)版、簡(jiǎn)潔版

      前者適合新手,后者適合老手(方便大家查找,從而過濾掉某些步驟,節(jié)約時(shí)間成本) 所以大家按需查看喲。

      詳細(xì)版 簡(jiǎn)潔版

      簡(jiǎn)潔版:包含所有步驟,以及命令的執(zhí)行過程(適合新手)

      簡(jiǎn)潔版:只包含命令(適合有一定熟練度的人)

      工作原理


      正向代理

      • 客戶端--->代理服務(wù)器--->訪問的域名--->訪問的服務(wù)器
      • 客戶端<---代理服務(wù)器<---訪問的域名<---訪問的服務(wù)器
        簡(jiǎn)單總結(jié):正向代理是到客戶端

      舉個(gè)栗子:我們打韓服的LOL有延遲,我們就可以找一個(gè)代理(香港的vpn),代理訪問國(guó)外的服務(wù)器,然后返回給代理,最后返回給我們。可以理解成加速器。
      在這里插入圖片描述

      反向代理

      • 客戶端--->訪問的域名--->代理服務(wù)器--->訪問的服務(wù)器
      • 客戶端<---訪問的域名<---代理服務(wù)器<---訪問的服務(wù)器
        簡(jiǎn)單總結(jié):反向代理是到服務(wù)端

      舉個(gè)栗子:我們?cè)谠L問百度的時(shí)候一直都是www.baidu.com這個(gè)域名,其實(shí)域名后面有很多服務(wù)器(ip地址),訪問域名-->代理服務(wù)器后到百度的服務(wù)器,最后返回給我們html頁面。
      在這里插入圖片描述

      環(huán)境準(zhǔn)備


      系統(tǒng) Vcpu Memory 網(wǎng)卡類型
      centos7 2 4 NAT模式

      沒有hexo博客環(huán)境看這里:還不會(huì)搭建博客嗎?centos7系統(tǒng)部署hexo博客新手入門-進(jìn)階,看這一篇就夠了_小葉的技術(shù)Logs的博客-CSDN博客

      詳細(xì)版

      入門:搭建步驟

      配置阿里云epel源:

      [root@localhost ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo  #下載epel源,否則沒有nginx包
      --2022-04-18 21:54:35--  http://mirrors.aliyun.com/repo/epel-7.repo
      Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 113.207.38.89, 113.207.38.90, 113.207.38.85, ...
      Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|113.207.38.89|:80... connected.
      HTTP request sent, awaiting response... 200 OK
      Length: 664 [application/octet-stream]
      Saving to: ‘/etc/yum.repos.d/epel.repo’
      
      100%[======================================================================================>] 664         --.-K/s   in 0s
      
      2022-04-18 21:54:36 (131 MB/s) - ‘/etc/yum.repos.d/epel.repo’ saved [664/664]
      

      yum安裝nginx:

      [root@localhost ~]# yum install -y nginx  #yum安裝nginx軟件
      Loaded plugins: fastestmirror
      Loading mirror speeds from cached hostfile
       * base: mirrors.aliyun.com
       * extras: mirrors.aliyun.com
       * updates: mirrors.aliyun.com
      Resolving Dependencies
      --> Running transaction check
      ---> Package nginx.x86_64 1:1.20.1-9.el7 will be installed
      --> Processing Dependency: nginx-filesystem = 1:1.20.1-9.el7 for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_1)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: nginx-filesystem for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: redhat-indexhtml for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: libcrypto.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
      --> Processing Dependency: libssl.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64
      

      啟動(dòng)nginx:

      [root@localhost ~]# systemctl stop firewalld && systemctl disabel firewalld  #關(guān)閉防火墻、開機(jī)不自啟防火墻
      [root@localhost ~]# setenforce 0  #臨時(shí)關(guān)閉selinux
      [root@localhost ~]# systemctl start nginx #啟動(dòng)nginx
      [root@localhost ~]# systemctl enable nginx #開機(jī)自啟nginx
      

      瀏覽器驗(yàn)證訪問nginx如圖所示:
      在這里插入圖片描述

      配置default.conf文件

      實(shí)現(xiàn)反向代理:

      [root@localhost ~]# cat /etc/nginx/conf.d/default.conf  # 如果沒有conf.d目錄需要?jiǎng)?chuàng)建,默認(rèn)我們這里下載的nginx版本沒有default.conf,創(chuàng)建即可
      
      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://127.0.0.1:4000;  #http根/目錄,代理到http://127.0.0.1:4000
              }
      }
      
      [root@localhost ~]# systemctl restart nginx
      

      最后驗(yàn)證
      你會(huì)發(fā)現(xiàn)直接瀏覽器輸入ip,不輸入4000端口也實(shí)現(xiàn)了訪問

      over如下圖所示:
      在這里插入圖片描述在這里插入圖片描述


      卸載

      [root@localhost ~]# yum remove -y nginx  #yum卸載nginx
      Loaded plugins: fastestmirror
      Resolving Dependencies
      --> Running transaction check
      ---> Package nginx.x86_64 1:1.20.1-9.el7 will be erased
      --> Finished Dependency Resolution
      
      Dependencies Resolved
      
      ================================================================================================================================
       Package                    Arch                        Version                                Repository                  Size
      ================================================================================================================================
      Removing:
       nginx                      x86_64                      1:1.20.1-9.el7                         @epel                      1.7 M
      
      Transaction Summary
      ================================================================================================================================
      Remove  1 Package
      
      Installed size: 1.7 M
      Downloading packages:
      Running transaction check
      Running transaction test
      Transaction test succeeded
      Running transaction
        Erasing    : 1:nginx-1.20.1-9.el7.x86_64                                                                                  1/1
      warning: /etc/nginx/nginx.conf saved as /etc/nginx/nginx.conf.rpmsave
        Verifying  : 1:nginx-1.20.1-9.el7.x86_64                                                                                  1/1
      
      Removed:
        nginx.x86_64 1:1.20.1-9.el7
      
      Complete!
      
      [root@localhost ~]# rm -rf /etc/nginx*  #刪除相關(guān)配置文件目錄
      

      簡(jiǎn)潔版

      搭建步驟

       wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
       yum install -y nginx
       [root@localhost ~]# systemctl stop firewalld && systemctl disabel firewalld
      瀏覽器 驗(yàn)證
      
      [root@localhost ~]# setenforce 0
      [root@localhost ~]# systemctl start nginx
      [root@localhost ~]# systemctl enable nginx
      [root@localhost ~]# cat /etc/nginx/conf.d/default.conf
      
      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://127.0.0.1:4000;     
              }
      }
      [root@localhost ~]# systemctl restart nginx
      瀏覽器 驗(yàn)證
      

      卸載

      [root@localhost ~]*# yum remove -y nginx*
      [root@localhost ~]*# rm -rf /etc/nginx**
      
      posted @ 2022-04-20 08:56  秋意零  閱讀(173)  評(píng)論(0)    收藏  舉報(bào)
      主站蜘蛛池模板: 国产精品沙发午睡系列990531| 五月天免费中文字幕av| 国产成人无码免费视频在线| 中文一区二区视频| 全免费A级毛片免费看无码| 国产精品爆乳奶水无码视频免费| 特黄三级又爽又粗又大| 精品人妻伦九区久久aaa片| 国产成人精品18| 亚洲护士一区二区三区| 亚洲一区二区三区自拍麻豆| 国产免费午夜福利在线播放| 国产精品露脸视频观看| 91精品亚洲一区二区三区| 茄子视频国产在线观看| 国产情侣激情在线对白| 亚洲av无码国产在丝袜线观看| 国产乱久久亚洲国产精品| 国产久9视频这里只有精品| 在线播放深夜精品三级| 国产精品自在拍在线播放| 无码一区二区三区免费| 欧美精品黑人粗大破除| 亚洲欧美人成网站在线观看看| 国产无套内射普通话对白| 国产一区二区三区四区激情| 国产无人区码一区二区| 久久本道综合久久伊人| 国产深夜福利视频在线| 国产精品一区二区黄色片| 天堂亚洲免费视频| 免费无码又爽又刺激高潮虎虎视频 | 久久一区二区中文字幕| 日本亚洲一区二区精品久久| 青青青爽在线视频观看| 亚洲中文字幕无码久久精品1| 国模少妇无码一区二区三区| 亚洲熟妇在线视频观看| 老熟女熟妇一区二区三区| 欧美成人午夜精品免费福利| 麻豆a级片|