linux构建web主机
生活随笔
收集整理的這篇文章主要介紹了
linux构建web主机
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
實現目的: 在Fedora10.0下架設Apache服務器,為Windows提供web訪問服務。實現不同用戶(test1,test2,mm1,mm2)的不同訪問權限。并且實現基于IP(192.168.1.6與192.168.1.119)和端口(192.168.1.6:80與192.168.1.6:8090)的虛擬主機功能。 實現步驟: 安裝好Fedora7.0后,系統已經安裝好了Apache服務。路徑為 /etc/httpd 其中/etc/httpd/conf/httpd.conf為Apache服務的主配置文件,下面進行配置。 ServerRoot "/etc/httpd"???? //指定Apache服務的啟動路徑 Listen 192.168.1.6:80???? //啟動偵聽端口 Listen 192.168.1.6:8090???? //啟動基于端口8090的虛擬主機的偵聽 Listen 192.168.1.119:80???? //啟動基于端口80的虛擬主機的偵聽 User apache??????? Group apache????????????? //指明啟動Apache服務的用戶和組 ServerAdmin ccx193@163.com?? //指明訪問失敗時的聯系郵箱 ServerName www.ccx.com:80????????? //指定服務器域名 DocumentRoot "/opt/ouc-server" <Directory "/opt/ouc-server">?????????? //指明web服務的目錄 DirectoryIndex index.php index.htm index.html index.html.var //上面這一行指明當Apache服務接受訪問時,搜索主頁的順序,由前至后 //下面實現基于IP的虛擬主機功能: <VirtualHost 192.168.1.6:8090> ????????????? ServerAdmin?? root@localhost ????????????? DocumentRoot /var/www/html???????? //定義該虛擬主機的目錄 ????????????? ServerName??? localhost </VirtualHost> <VirtualHost 192.168.1.119> ????????????? ServerAdmin?? root@localhost ????????????? DocumentRoot /var/www/html ????????????? ServerName??? localhost </VirtualHost> //用圖形界面來添加一個ip記錄 下面實現用戶管理功能: <Directory "/opt/ouc-server"> ?????? Authname "ccx's Apache server"??? //登錄時顯示在對話框上的提示信息 ?????? AuthType Basic????????????????? //用戶驗證類型 ?????? AuthUserFile /etc/httpd/passwd???? //用戶密碼存放文件,需自己創建 ?????? AuthGroupFile /etc/httpd/groupfile?? // 組用戶存放文件,需自己創建 ?????? Require group ouc??????????????? //允許訪問的組,我這里建立了組ouc </Directory> 建立passwd文件: # htpasswd /etc/httpd/passwd test1 # htpasswd?? /etc/httpd/passwd test2 #htpasswd?? /etc/httpd/passwd mm1 #htpasswd?? /etc/httpd/passwd mm2 建立groupfile文件: # cat /etc/httpd/groupfile ouc: test1 test2 mm1 mm2 重新啟動Apache服務器: # service httpd restart 下面我們就可以在Windows下訪問建立好的網站.
轉載于:https://blog.51cto.com/chinajava/342599
總結
以上是生活随笔為你收集整理的linux构建web主机的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MyEclipse快捷键与插件大全
- 下一篇: 每天必做的八件事