精品专区-精品自拍9-精品自拍三级乱伦-精品自拍视频-精品自拍视频曝光-精品自拍小视频

網站建設資訊

NEWS

網站建設資訊

詳述CentOS7中Apache配置與應用(一)

系統運維 Apache連接保持 Apache連接保持相關參數

KeepAlive

創新互聯專注于曹妃甸網站建設服務及定制,我們擁有豐富的企業做網站經驗。 熱誠為您提供曹妃甸營銷型網站建設,曹妃甸網站制作、曹妃甸網頁設計、曹妃甸網站官網定制、成都小程序開發服務,打造曹妃甸網絡公司原創品牌,更為您提供曹妃甸網站排名全網營銷落地服務。是否打開連接保持,OFF關閉,ON打開

KeepAlive\' Timeout

一次連接多次請求之間的間隔時間,兩次請求超過該時間連接斷開 MaxKeepAliveRequests 一次連接能夠 傳輸的請求數量 Apache訪問控制

作用

控制對網站資源的訪問 為特定的網站目錄添加訪問授權 常用訪問控制方式 客戶機地址限制 用戶授權限制 基于客戶端地址的訪問控制

使用Require配置項實現訪問控制,按先后順序限制

可用于<Location>、<Directory>、<Files>、 <Limit>配置段中

Require配置項的常見語法
Require all granted
Require all denied
Require local
Require [not] host <主機名或域名列表>
//使用not禁止訪問時要將其置于 容器中并在容器中指定相應的限制策略
Require [not] ip 
配置實例

Linux系統中安裝dns、HTTP服務,并設置DNS服務。

[root@localhost ~]# yum install bind httpd -y   //安裝服務
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
...//省略部分內容...
已安裝:
  bind.x86_64 32:9.11.4-9.P2.el7                    httpd.x86_64 0:2.4.6-90.el7.centos 
...//省略部分內容...  
完畢!
[root@localhost conf]# vim /etc/named.conf    //編輯DNS配置文件
...//省略部分內容...
options {
        listen-on port 53 { any; };            //更改IP地址為any
        listen-on-v6 port 53 { ::1; };
        directory       /var/named;
        dump-file       /var/named/data/cache_dump.db;
        statistics-file /var/named/data/named_stats.txt;
        memstatistics-file /var/named/data/named_mem_stats.txt;
        recursing-file  /var/named/data/named.recursing;
        secroots-file   /var/named/data/named.secroots;
        allow-query     { any; };             //更改監聽主機為any
...//省略部分內容... 
:wq
[root@localhost conf]# vim /etc/named.rfc1912.zones     //編輯區域配置文件
...//省略部分內容...
zone kgc.com IN {                      //更改域名
        type master;
        file kgc.com.zone;         //更改區域數據文件名
        allow-update { none; };
};
...//省略部分內容...
:wq
[root@localhost conf]# cd /var/named/           //進入區域數據文件目錄
[root@localhost named]# ls                     //查看目錄
data  dynamic  named.ca  named.empty  named.localhost  named.loopback  slaves
[root@localhost named]# cp -p named.localhost kgc.com.zone     //復制區域數據文件
[root@localhost named]# vim kgc.com.zone               //進入編輯文件
$TTL 1D 
@       IN SOA  @ rname.invalid. (
         0       ; serial
         1D      ; refresh
         1H      ; retry
         1W      ; expire
         3H )    ; minimum
        NS      @
        A       127.0.0.1
www IN  A       192.168.144.133                   //設置域名解析
:wq                                        //保存退出

開啟兩臺win 10客戶機,并查看客戶機IP地址

在Linux系統中進入http服務站點目錄,編輯主頁內容,并開啟DNS、HTTP服務,關閉防火墻及增強性安全功能

[root@localhost named]# cd /var/www/html/    //進入http服務站點目錄
[root@localhost html]# vim index.html             //編輯默認主頁

this is kgc web

//編輯內容 :wq [root@localhost html]# ls //查看 index.html [root@localhost html]# cat index.html //查看網頁內容

this is kgc web

[root@localhost html]# systemctl start httpd.service //啟動http服務 [root@localhost html]# systemctl start named //啟動DNS服務 [root@localhost html]# systemctl stop firewalld.service //關閉防火墻 [root@localhost html]# setenforce 0 //關閉增強性安全功能

使用兩臺win 10客戶機分別訪問往網站信息,看服務是否正常提供

在Linux系統中配置HTTP服務配置文件,設置客戶機訪問權限

[root@localhost html]# vim /etc/httpd/conf/httpd.conf  
//編輯主配置文件內容(現網中不建議直接修改主配置文件內容,可以重新添加子配置文件進行限制)
...//省略部分內容...

    #
    # Possible values for the Options directive are None, All,
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that MultiViews must be named *explicitly* --- Options All
    # doesn\'t give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be All, None, or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
                               //在此容器下添加子容器
       Require not ip 192.168.144.128              //添加限制訪問主機的IP地址(如若限制網段直接添加192.168.144.0/24即可,注意限制網段需填寫子網掩碼)
       Require all granted
    

...//省略部分內容...
:wq
[root@localhost html]# systemctl restart httpd.service 

查看限制的第一臺win 10客戶端是否還可以訪問網站

用戶授權限制 配置實例

創建用戶認證數據庫

[root@localhost html]# htpasswd -c /etc/httpd/conf/pwd test01  
//創建用戶認證數據庫(-c為創建,如果已經存在數據認證文件可以不用-c,直接就可以使用命令添加進認證文件中)
New password:               //輸入設置的密碼
Re-type new password:         //再次輸入密碼
Adding password for user test01  //成功創建
[root@localhost html]# cd /etc/httpd/conf        //進入目錄
[root@localhost conf]# ls        //查看
httpd.conf  magic  pwd            //成功創建文件
[root@localhost conf]# cat pwd     //查看文件內容
test01:$apr1$zDZ/54yz$rUCXaWixaltHE6ZBvjv0h/    //創建的用戶及密碼

添加用戶授權配置

[root@localhost conf]# vim httpd.conf
...//省略部分內容...

    #
    # Possible values for the Options directive are None, All,
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that MultiViews must be named *explicitly* --- Options All
    # doesn\'t give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be All, None, or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
   AuthName DocumentRoot                      //更改上面的訪問控制條目,此條目聲明驗證信息
   AuthType Basic                               //驗證類型為基本驗證
   AuthUserFile /etc/httpd/conf/pwd             //驗證文件路徑
   Require valid-user                           //設置為授權用戶驗證

...//省略部分內容...
:wq                                          //保存退出
[root@localhost conf]# systemctl restart httpd.service  //重新啟動服務

在客戶機中驗證配置


文章名稱:詳述CentOS7中Apache配置與應用(一)
網址分享:http://m.jcarcd.cn/article/cpoegj.html
主站蜘蛛池模板: 国产精品毛多多 | 国产va在线播放 | 国产91福利在线精 | 国产wwwww| 日韩成人 | 国产亚洲精品导航 | 日本乱伦中文自拍 | 国产美女视频免费 | 国产亚洲首页 | 片在线观看 | 午夜伦伦 | 午夜影视免费 | 国产网红福 | 国产萝控精品福利 | 精品香蕉 | 日本区在线观看 | 午夜剧场| 中文字幕一区婷婷久 | 国内偷拍福利小视频 | 区水蜜桃在线观看 | 欧美日韩一卡 | 精品黑人一区 | 欧美日韩不卡 | 欧美综合日韩 | 精品视频一区二区 | 果冻影视 | 韩国电影美人图 | 国产精品国产国产 | 日本精品大胆 | 国产亚洲精品国产 | 国产高清视频色拍 | 国产精品永久在线 | 精品国产污免费 | 午夜国产福到在线 | 精品国产免费福利片 | 精品动漫一区二区 | 午夜福利免费 | 欧美在线精品视频a | 99ri| 日本三级在 | 日本视频中文字幕 |