Web服務的基本應用

來源:互聯網
上載者:User

標籤:justify   伺服器   style   資訊   

  1. Web服務的相關資訊

    Apache伺服器是web服務的重要應用

    在這也是講的apache

這裡需要安裝一個http服務軟體才行!

Apache的根文檔在/var/www/html

主設定檔 /et/httpd/conf/httpd.conf

Httpd_devel(提供相關指令)httpd_manual

訪問記錄檔 /var/log/httpd/error_log

連接埠:80(http) 443(https)

模組載入目錄:/var/httpd/conf.d/

  1. 實驗過程
    1. 個人首頁

      第一步,搭DNS服務(這個在DNS服務裡有,這裡就不再重複了),作為ip地址的網域名稱解析

第二步,進入http的主設定檔/etc/httpd/conf/httpd.conf中,這裡就可以設定個人首頁了

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/58/wKiom1SJgUnDlh_eAADAMEhLUmA349.jpg" />

那麼接下來我們就進入/home中,會看到tt這個使用者目錄檔案

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/55/wKioL1SJgeHw2vo3AAAiGGcSrOc841.jpg" />

然後再tt下建立Public_html目錄,這個其實是httpd服務的context值,這是為了可以識別的作用

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/58/wKiom1SJgUnyMn0eAAAm51XIxow973.jpg" />

然後再在public_html下面建立index.html檔案,這個就是網頁檔案了,然後在檔案裡寫自己想要的東西

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/55/55/wKioL1SJgeHRmmdKAAAq_7NikUM289.jpg" />650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/55/58/wKiom1SJgUnSjiGKAAAhp4jMXxw987.jpg" />

接下來就需要給tt這個目錄檔案及其下面檔案的讀的許可權了

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/56/wKioL1SJgeGzatGrAABGiif_-zg676.jpg" />

接下來開啟bool開關

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/58/wKiom1SJgUmBbrSZAACgO1fX_ko651.jpg" />

然後訪問網頁,就可以看到了

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/55/58/wKiom1SJgUvAhM9kAAC8iQk_Lu8612.jpg" />

然後為了去掉~,我們可以做一個軟連結,即將tt連結到/var/www/html下面

Ln s /home/tong/public_html tong

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/58/wKiom1SJgUvzVxxhAABlSKH7ks8943.jpg" />

然後訪問網站

  1. 虛擬機器主機(在同一台伺服器上運行多個網站)

在www下建立virt1目錄檔案

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/58/wKiom1SJgUuDFfChAAAxD1bIF_U425.jpg" />

然後進入virt1中建立index.html檔案

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/56/wKioL1SJgePxm4bWAAA7iowFkQA928.jpg" />

然後在裡面寫東西

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/58/wKiom1SJgUuyiWcOAAAdBvVepT0642.jpg" />

這時還有進入http的主設定檔/etc/httpd/conf/httpd.conf,進行配置

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/58/wKiom1SJgUyABvzkAACNVAx0nKs115.jpg" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/56/wKioL1SJgeSBtytgAACnOKBasO0641.jpg" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/55/56/wKioL1SJgeWQEiPRAAIUzxIq5_M940.jpg" />

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/56/wKioL1SJgeWC5-B2AAC42p-bYOI258.jpg" />

現在就看不到了吧

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/56/wKioL1SJgeXhsBohAAEOia0XuxU404.jpg" />

如果不允許192.168.1.115訪問ns.example.com,我們依舊可以進入http的主設定檔進行設定

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/55/58/wKiom1SJgU2T6r96AADY4x9Yhjg637.jpg" />

然後我們就訪問不到了

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/56/wKioL1SJgeXhMliuAAHHByUJ_0o143.jpg" />

最後做一個只允許名為boss的帳號訪問www.example.com

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/58/wKiom1SJgU7BM2ESAABfvBYPfvA303.jpg" />

vim /etc/http.htpasswd

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/55/56/wKioL1SJgebD1eU5AAAmLXLA6bs240.jpg" />

進入/var/www/virt1/.htaccess中,加入下面幾個

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/56/wKioL1SJgeaCKAykAAA3AczQwlE230.jpg" />

然後重啟http服務,訪問網站

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/55/58/wKiom1SJgU_zMiSkAACoJt7sSYU053.jpg" />

自此實驗結束!!!

Web服務的基本應用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.