實驗:httpd

虛擬主機

httpd-2.4示例步驟:

1. 進行規劃虛擬主機
192.168.209.8:80,192.168.209.10:80
www.10linux.com,www.iounix.com
/var/www/html/10linux,/var/www/html/iounix

2.
]# mkdir /var/www/html/{10linux,iounix}
~]# vim /var/www/html/iounix/index.html
    <h1>iounix.com</h1>
~]# vim /var/www/html/10linux/index.html
    <h1>10linux.com</h1>
    <h2>welcome here</h2>

3. 編輯配置文件
/etc/httpd/conf.d/10linux.conf
<VirtualHost 192.168.209.8:80>
        ServerName www.10linux.com
        DocumentRoot "/var/www/html/10linux"
        <Directory "/var/www/html/10linux">
                Options None
                AllowOverride None
                Require all granted
        </Directory>
        CustomLog "logs/10linux_access_log"
</VirtualHost>

/etc/httpd/conf.d/iounix.conf
<VirtualHost 192.168.209.10:80>
        ServerName www.iounix.com
        DocumentRoot "/var/www/html/iounix"
        <Directory "/var/www/html/iounix">
                Options None
                AllowOverride None
                Require all granted
        </Directory>
        CustomLog "logs/iounix_access_log" combined
</VirtualHost>

4.
httpd -t
systemctl restart httpd.service

5. 驗證:不同IP,相同端口
    ip addr add 192.168.209.10/24 dev eth0
6. 驗證:相同IP,不同端口
    需在配置文件中添加Listen 10080,修改IP地址; 使IP相同,port不同
    ip addr del 192.168.209.10/24 dev eth0

7. 驗證:相同IP,相同端口,不同主機名
    可搭建DNS解析驗證

問題:重啟httpd服務Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.

httpd內建的狀態頁面

httpd-2.4示例:

1
vim /etc/httpd/conf.d/10linux.conf
<VirtualHost 192.168.209.8:80>
        ServerName www.10linux.com
        DocumentRoot "/var/www/html/10linux"
        <Directory "/var/www/html/10linux">
                Options None
                AllowOverride None
                Require all granted
        </Directory>
        CustomLog "logs/10linux_access_log"
        <Location /server-status>
            SetHandler server-status
            <RequireAll>
                Require ip 172.16
            </RequireAll>
        </Location>    
</VirtualHost>

2
查看:www.10linux.com/server-status

3
如要做認證:
<Location /server-status>
    SetHandler server-status
    AuthType ...
    ...

</Location>

原創文章,作者:s,如若轉載,請注明出處:http://www.www58058.com/77502

(0)
ss
上一篇 2017-06-04 21:33
下一篇 2017-06-04 21:41

相關推薦

  • Linux命令學習

    閱讀目錄 Linux cat命令 file命令 dd命令 hexdump命令 cat命令   cat三大功能:      1.一次顯示整個文件:cat filename      2.從鍵盤創建一個文件:cat > filename 注意只能創建新文件,…

    Linux干貨 2017-07-16
  • 文本處理工具

    1, head  默認顯示前十行 -n  +行號 顯示前n行 -行號 顯示前n行 -c 字節數 顯示前n個字節 tail 默認顯示后十行 -n +行號 顯示后n行 – 行號 顯示后n行 -f 動態顯示 cut -d 指定分隔符 -f 選取第幾列 –output-delimiter 指定輸出符 相關的實際操作: a,…

    2017-07-29
  • CentOS7的啟動及Systemd的管理?

    CentOS7的啟動流程     POST–>Boot Sequence–>Bootloader–>kernel+initramfs(initrd)–>rootfs–>/sbin/init    &n…

    Linux干貨 2016-09-21
  • linux 簡單命令

    前面介紹一些基本基礎篇 后面主要介紹screen命令的用法。

    2017-11-19
  • N25-第一周

    一:計算機主要組成及其功能 計算機的主要組成部分可以歸納為以下五個部分:控制器、運算器、存儲器、輸入設備、和輸出設備。  功能介紹:         1.控制器          …

    Linux干貨 2016-12-04
  • Mogilefs使用Nginx實現代理訪問

    MogileFS介紹:  MogileFS是一個開源的分布式文件存儲系統,由LiveJournal旗下的DangaInteracitve公司研發??芍С治募詣觽浞堑墓δ?,提供高可用性和高可擴展性。 MogileFS組件:  trackers:   MoglieFS的調度器,是mogileFS的核心,訪問入口。  功能…

    Linux干貨 2015-08-06
欧美性久久久久