一、實驗的目的:
實現Apathe部署WEB項目,學會處理多個網站之間互相工作,實現主機託管
給網頁添加訪問權限
二、實驗過程(學生補充完整的細節並作簡要的解釋)
(一)準備
1、檢查httpd 是否安裝
[root@localhost root]# rpm -qa | grep httpd
httpd-manual-2.0.40-21
httpd-2.0.40-21
證明 已經安裝了
2、檢查httpd 是否已啓動
方法一:
[root@localhost root]# ps -ax | grep httpd
10958 ? S 0:00 /usr/sbin/0httpd
11086 ? S 0:00 [httpd]
11087 ? S 0:00 [httpd]
11088 ? S 0:00 [httpd]
11089 ? S 0:00 [httpd]
11090 ? S 0:00 [httpd]
11091 ? S 0:00 [httpd]
11092 ? S 0:00 [httpd]
11093 ? S 0:00 [httpd]
11342 pts/0 S 0:00 grep httpd
方法二
[root@localhost root]# chkconfig --list httpd
httpd 0:關閉 1:關閉 2:啓用 3:啓用 4:啓用 5:啓用 6:關閉
證明已經啓動
(二)設置缺省字符集
1、編輯主配置文件,設置缺省字符集爲 utf-8
[root@localhost root]# vi /etc/httpd/conf/httpd.conf
按:進入命令行 輸入/AddDefau
修改爲AddDefaultCharset utf-8
2、重啓 httpd
[root@localhost conf]# service httpd restart
停止 httpd: [ 確定 ]
啓動 httpd: [ 確定 ]
3、設計缺省主頁 index.html,含中文。
[root@localhost root]# cd /var/www/html
[root@localhost html]# vi index.html
這是index主頁
正文1
正文2
4、window 瀏覽器測試
http://192.168.233.3
看能否顯示中文
這是index主頁 正文1 正文2
顯示中文
(三)允許局部配置,默認不允許 /var/www/html 下的目錄索引
[root@localhost html]# vi /etc/httpd/conf/httpd.conf
:/AllowOverride 查找 ,按“N”查找下一個找到其中 <Directory "var/www/html">
將下面的二個修改如下:
Options -Indexes FollowSymLinks (不允許目錄索引)
AllowOverride All (允許局部配置)
重啓 httpd
[root@localhost conf]# service httpd restart
停止 httpd: [ 確定 ]
啓動 httpd: [ 確定 ]
(四)在/var/www/html 下創建目錄 lab,局部允許目錄索引
1、在/var/www/html 下創建目錄 lab,並創建11.txx
[root@localhost conf]# cd /var/www/html
[root@localhost html]# mkdir lab
[root@localhost lab]# cat 11.txt
lab
assd
第衛星
2、局部允許目錄索引
[root@localhost lab]# cat > .htaccess
Options Indexes
3、驗證成果
在瀏覽器中輸入http://192.168.177.3/lab/,可以看到
Index of /lab
Icon Name Last modified Size Description
[DIR] Parent Directory -
[TXT] 11.txt 02- 4月-2015 14:46 19
(五)個人主頁
1、編輯主配置文件,註解掉
UserDir disable
去掉註解
UserDir public_html
重啓 httpd。
[root@localhost lab]# vi /etc/httpd/conf/httpd.conf
按:,輸入 /User 搜索,修改如下
# UserDir disable
UserDir public_html
root@localhost conf]# service httpd restart
停止 httpd: [ 確定 ]
啓動 httpd: [ 確定 ]
2、用戶 yanji 建立個人主頁,給相關目錄添加適當的權限
[root@localhost root]# su - yanji
[yanji@localhost yanji]$ zh
[yanji@localhost yanji]$ mkdir public_html
[yanji@localhost yanji]$ cd public_html
[yanji@localhost public_html]$ cat > index.html
<h1>
yanj主頁
</h1>
加權限
[yanji@localhost public_html]$ chmod 701 .
[yanji@localhost yanji]$ chmod 701 .
3、Windows 瀏覽器訪問 yanji 的個人主頁。
在瀏覽器輸入http://192.168.177.3/~yanji
三、實驗的體會
比較有趣,適合使用。實踐起來還是要看書,步驟容易出錯
配置Apathe服務器
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
阿里雲Ubuntu服務器搭建Javaweb開發環境
只修电脑不过夜
2018-08-27 20:03:20
Linux 系統下 CodeBlocks安裝與使用
花姑
2018-08-27 20:02:59
Linux後臺執行的方法 - 關閉、退出不影響
saife
2018-08-27 20:00:14
Can't read dir of '.' (errno: 13)
saife
2018-08-27 20:00:13
mysqldump: Got error: 1: Can't create/write to file '/data/export/test.txt' (Errcode: 13)
saife
2018-08-27 20:00:11
Ubuntu安裝inception錯誤處理make[2]: *** [sql/CMakeFiles/sql.dir/sql_yacc.cc.o] Error 1
saife
2018-08-27 20:00:11
linux bash腳本編程
li528405176
2018-08-27 19:57:05
linux 基礎命令(一):文件系統跳轉與操作系統探究——date,cal,df,free,exit,pwd,cd,ls,命令選項和參數,file,less,系統目錄,硬鏈接與軟鏈接
li528405176
2018-08-27 19:57:03
linux常用命令全拼
jlegend
2018-08-27 19:57:02
關於Lempel-Ziv壓縮算法的筆記
blueimpulse
2018-08-27 19:56:49
Linux下無線網卡安裝2
blueimpulse
2018-08-27 19:56:48
Linux之無線世界(在Linux平臺配置無線網卡)
blueimpulse
2018-08-27 19:56:48
《轉》QT_BEGIN_NAMESPACE、QT_END_NAMESPACE 等問題
wang_ji_min
2018-08-27 19:56:35
linux下 /etc/profile、~/.bash_profile ~/.profile的執行過程
wang_ji_min
2018-08-27 19:56:21
[轉]動態磁盤和LVM。好文章
hawstein
2018-08-27 19:56:18