Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1799026
  • 博文数量: 334
  • 博客积分: 11301
  • 博客等级: 上将
  • 技术积分: 3452
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-18 10:19
个人简介

路虽弥,不行不至;事虽少,不做不成。

文章分类

全部博文(334)

文章存档

2013年(4)

2012年(19)

2011年(27)

2010年(71)

2009年(45)

2008年(15)

2007年(84)

2006年(69)

分类: LINUX

2007-01-30 13:46:33

一.apache服务一览
=======================================================
. 后台进程:httpd
. 脚本:/etc/rc.d/init.d/httpd
. 使用端口:80(http),443(https)
. 所需RPM包:httpd,httpd-devel
. 相关RPM包:rfapache,mod_ssl,elinks(文本浏览器)
. 配置路径:/etc/httpd/*,/var/www/*
=======================================================
要求:
   用户tom,jack可以访问/opt/smb-server目录,而ivan没有访问权限
 
 
1.在/etc/httpd/conf/httpd.conf最后加入下面虚拟主机(基于名称或基于IP)
虚拟主机(基于名称)
  Listen 8080                          --更改默认端口
  NameVirtualHost *:8080
 
     DocumentRoot /var/www
     ServerName        --在DNS中定义或直接修改/etc/hosts
     Alias /doc "/opt/smb-server"     --要访问的目录
    
       Options Indexes MultiViews    
       AllowOverride AuthConfig       --在/opt/smb-server目录下定义.htaccess
#       Order allow,deny   
#       Allow  from  192.168.1.117
#      Allow from all
#      Deny from all
    

 
  
虚拟主机(基于IP)
 
     DocumentRoot /var/www
     ServerName mail.saeg.com.cn
     Alias /doc "/opt/smb-server"
    
       Options Indexes MultiViews
       AllowOverride AuthConfig
#       Order allow,deny
#       Allow  from  192.168.1.2
#      Allow from all
#      Deny from all
    

 
 
注明:httpd -t检查语法是否正确
    [root@test ~]# httpd -t
     Syntax OK     
 
2.定义apache访问/opt/smb-server目录的用户
=======================================================
 htpasswd -c /etc/httpd/conf/password tom
 htpasswd /etc/httpd/conf/password jack
 
 
3.htaccess内容
=======================================================
AuthType Basic
AuthName "test"
AuthUserFile /etc/httpd/conf/passwords
Require user tom jack     --该处user为关键字
 
4.启用httpd服务
=======================================================
  chkconfig --level 345 httpd on
  service httpd restart
 
 
5.测试
=======================================================
 elinks  
 
 
二.proxy代理
=======================================================
1.安装squid包
  rpm -ivh --force --aid squid*.rpm
 
2.修改/etc/squid/squid.conf
  >开放端口号3128
     http_port 3128
  >定义代理访问列表
     acl squid src 192.168.1.0/24
  >在httpd_access deny all上加入如下内容
     httpd_access allow squid
3.启用squid服务
  chkconfig --level 345 squid on
  service squid restart
 
 
官方文档

  
 
  
 
  
 

 
 
 
 
阅读(1651) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~