实现目的:
Fedora 10 .0 下架设 Apache 服务器,为 Windows 提供 web 访问服务。实现不同用户( test1,test2 ,mm1,mm2)的不同访问权限。并且实现基于 IP 192.168.1. 6与 192.168.1. 119)和端口( 192.168.1. 6: 8 0与 192.168.1. 6:8090)的虚拟主机功能。
实现步骤:
安装好 Fedora 7 .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      // 启动基于端口 8 090的虚拟主机的侦听
Listen 192.168.1. 119:80      // 启动基于端口 8 0的虚拟主机的侦听
User apache       
Group apache               // 指明启动 Apache 服务的用户和组
ServerAdmin ccx193@163.com    // 指明访问失败时的联系邮箱
ServerName www.ccx.com:80           // 指定服务器域名
DocumentRoot "/opt/ouc-server"
           // 指明 web 服务的目录
DirectoryIndex index.php index.htm index.html index.html.var
// 上面这一行指明当 Apache 服务接受访问时,搜索主页的顺序,由前至后
//下面实现基于 IP 的虚拟主机功能:
6:8090 >
              ServerAdmin   root@localhost
              DocumentRoot / var/www/html          // 定义该虚拟主机的目录
              ServerName    localhost
119 >
              ServerAdmin   root@localhost
              DocumentRoot / var/www/html
              ServerName    localhost
//用图形界面来添加一个ip记录
下面实现用户管理功能:
       Authname " ccx 's Apache server"    // 登录时显示在对话框上的提示信息
       AuthType Basic                  // 用户验证类型
       AuthUserFile /etc/httpd/passwd     // 用户密码存放文件,需自己创建
       AuthGroupFile /etc/httpd/groupfile   // 组用户存放文件,需自己创建
       Require group ouc                // 允许访问的组,我这里建立了组 ouc
建立 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 下访问建立好的网站.