亚洲欧美精品沙发,日韩在线精品视频,亚洲Av每日更新在线观看,亚洲国产另类一区在线5

<pre id="hdphd"></pre>

  • <div id="hdphd"><small id="hdphd"></small></div>
      學習啦>學習電腦>操作系統(tǒng)>Linux教程>

      Linux怎么搭建Web服務器

      時間: 春健736 分享

        Web服務器一般指網(wǎng)站服務器,是指駐留于因特網(wǎng)上某種類型計算機的程序,可以向瀏覽器等Web客戶端提供文檔,[1] 也可以放置網(wǎng)站文件,讓全世界瀏覽;可以放置數(shù)據(jù)文件,讓全世界下載。那么Linux怎么搭建Web服務器?下面跟著學習啦小編一起來了解一下吧。

        Linux怎么搭建Web服務器

        1,基于apache的web服務器基礎搭建:

        (1)實驗環(huán)境:一臺ip為192.168.10.10的rhel5.9主機作為web服務器,一臺ip為192.168.10.15的win7主機作為測試機

        (2)查看服務主機軟件是否安裝

        [root@ser1 ~]# rpm -q httpd httpd-manual httpd-devel

        package httpd is not installed

        package httpd-manual is not installed

        package httpd-devel is not installed

        (3)安裝軟件包

        [root@ser1 ~]# yum install -y httpd httpd-manual httpd-devel

        (4)啟動服務

        [root@ser1 ~]# service httpd start

        啟動httpd: [確定]

        [root@ser1 ~]# chkconfig httpd on

        (5)在win7上測試,無網(wǎng)頁缺省下顯示紅帽測試頁

        <報錯頁面存放位置/var/www/error/noindex.html>

        (6)打開配置文件

        [root@ser1 ~]# vim /etc/httpd/conf/httpd.conf

        可獲得以下重要字段:

        目錄設置:

        <Directory 目錄> .. .. </Directory>

        訪問位置設置:

        <LocationURL> .. .. </Location>

        虛擬主機設置:

        <VirtualHost 監(jiān)聽地址> .. .. </VirtualHost>

        常用的全局設置參數(shù):

        ServerName本站點的FQDN名稱

        DocumentRoot網(wǎng)頁文檔的根目錄:缺省/var/www/html/

        DirectoryIndex默認索引頁/首頁文件:一般設為index.html index.php

        ErrorLog錯誤日志文件的位置

        CustomLog 訪問日志文件的位置

        Listen 監(jiān)聽服務的IP地址、端口號

        ServerRoot 服務目錄:/etc/httpd/

        Timeout網(wǎng)絡連接超時,默認 300 秒

        KeepAlive是否保持連接,可選On或Off

        MaxKeepAliveRequests每次連接最多處理的請求數(shù)

        KeepAliveTimeout保持連接的超時時限

        Include 可包含其他子配置文件: /etc/httpd/conf.d/

        (7)創(chuàng)建測試網(wǎng)頁

        [root@ser1 ~]# vim /var/www/html/index.html

        <h1>

        This is a test page !!!

        </h1>

        ~

        (8)win7下測試,主頁變?yōu)闇y試網(wǎng)頁

        2,基于apache的web服務器的訪問控制:

        (1)web服務的地址限制

        I,rder 配置項,定義控制順序

        allow,deny 先允許后拒絕,缺省拒絕所有;沖突時,拒絕生效;allow不設置,拒絕所有

        deny,allow 先拒絕后允許,缺省允許所有;沖突時,允許生效;deny不設置,允許所有

        II,Allow/Deny from 配置項,設置權限

        Allow from 地址1 地址2 .. ..

        Deny from 地址1 地址2 .. ..

        配置如下:

        [root@ser1 ~]# vim /etc/httpd/conf/httpd.conf

        331 #

        332 Orderallow,deny

        333 Allowfrom 192.168.20.0/24

        334

        335 </Directory>

        [root@ser1 ~]# service httpd restart……重啟服務

        停止httpd: [確定]

        啟動httpd: [確定]

        在win7上測試,測試完成并還原配置文件:

        看過“ Linux怎么搭建Web服務器 ”的人還看了:

      1.win7如何搭建Web服務器

      2.基于WebRTC的瀏覽器端Web服務器的研究論文

      3.LINUX下配置管理APACHE服務器的方法

      4.如何安全設置Apache Web服務器

      5.全國網(wǎng)絡技術水平考試二級實踐指導書

      648961