一.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
官方文档
阅读(1698) | 评论(0) | 转发(0) |