Apache Server 的個案討論
来源:百度文库 编辑:神马文学网 时间:2024/07/05 16:27:20
個案1: 在同一台機器上 提供兩個 http 服務 (by domain name)
說明: 甲公司希望在一台機器上提供 http://www.aco.com.tw 供外界上網查公司的公開資訊,又提供 http://intranet.aco.com.tw 供員工使用內部的一些系統。
做法:
1. 首先在1個IP 上對應2個 domain name ( 需由 DNS 加入)
2. 更改 /etc/httpd/conf/httpd.conf 的最後面
#NameVirtualHost *
NameVirtualHost 210.240.252.2
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
DocumentRoot /var/www/html
ServerName www.aco.com.tw
ErrorLog logs/error_www_log
CustomLog logs/access_www_log common
DocumentRoot /var/www/html2
ServerName intranet.aco.com.tw
ErrorLog logs/error_intranet_log
CustomLog logs/access_intranet_log common
個案2: 在同一台機器上 提供兩個 http 服務 (by port number)
說明: 甲公司希望在一台機器上提供 http://www.aco.com.tw 供外界上網查公司的公開資訊,又提供 http://www.aco.com.tw:8080 供員工使用內部的一些系統。
做法:
1. 首先在1個IP 上對應2個 domain name ( 需由 DNS 加入)
2. 更改 /etc/httpd/conf/httpd.conf 的 listen 多加一行 Listen 8080
Listen 80
Listen 8080
3. 更改 /etc/httpd/conf/httpd.conf 的最後面
#NameVirtualHost *
NameVirtualHost 210.240.232.2
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
DocumentRoot /var/www/html
ServerName www.aco.com.tw
ErrorLog logs/error_www_log
CustomLog logs/access_www_log common
DocumentRoot /var/www/html2
ServerName intranet.aco.com.tw
ErrorLog logs/error_intranet_log
CustomLog logs/access_intranet_log common
個案3: 以密碼保護網頁
1. nano /etc/httpd/conf/httpd.conf
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
# AllowOverride None - by poter
AllowOverride All
2. [root@proxyd opt]# htpasswd -c /opt/.htpasswd tom
New password:
Re-type new password:
Adding password for user tom
3. cat /opt/.htpasswd
tom:fkzneVy61GKXw
4. nano /var/www/html/.htaccess
AuthUserFile /opt/.htpasswd
AuthName "Private directory"
AuthType Basic
require valid-user
from: http://poterp.iem.mit.edu.tw/linux/apache.htm
說明: 甲公司希望在一台機器上提供 http://www.aco.com.tw 供外界上網查公司的公開資訊,又提供 http://intranet.aco.com.tw 供員工使用內部的一些系統。
做法:
1. 首先在1個IP 上對應2個 domain name ( 需由 DNS 加入)
2. 更改 /etc/httpd/conf/httpd.conf 的最後面
#NameVirtualHost *
NameVirtualHost 210.240.252.2
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
DocumentRoot /var/www/html
ServerName www.aco.com.tw
ErrorLog logs/error_www_log
CustomLog logs/access_www_log common
DocumentRoot /var/www/html2
ServerName intranet.aco.com.tw
ErrorLog logs/error_intranet_log
CustomLog logs/access_intranet_log common
個案2: 在同一台機器上 提供兩個 http 服務 (by port number)
說明: 甲公司希望在一台機器上提供 http://www.aco.com.tw 供外界上網查公司的公開資訊,又提供 http://www.aco.com.tw:8080 供員工使用內部的一些系統。
做法:
1. 首先在1個IP 上對應2個 domain name ( 需由 DNS 加入)
2. 更改 /etc/httpd/conf/httpd.conf 的 listen 多加一行 Listen 8080
Listen 80
Listen 8080
3. 更改 /etc/httpd/conf/httpd.conf 的最後面
#NameVirtualHost *
NameVirtualHost 210.240.232.2
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
DocumentRoot /var/www/html
ServerName www.aco.com.tw
ErrorLog logs/error_www_log
CustomLog logs/access_www_log common
DocumentRoot /var/www/html2
ServerName intranet.aco.com.tw
ErrorLog logs/error_intranet_log
CustomLog logs/access_intranet_log common
個案3: 以密碼保護網頁
1. nano /etc/httpd/conf/httpd.conf
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
# AllowOverride None - by poter
AllowOverride All
2. [root@proxyd opt]# htpasswd -c /opt/.htpasswd tom
New password:
Re-type new password:
Adding password for user tom
3. cat /opt/.htpasswd
tom:fkzneVy61GKXw
4. nano /var/www/html/.htaccess
AuthUserFile /opt/.htpasswd
AuthName "Private directory"
AuthType Basic
require valid-user
from: http://poterp.iem.mit.edu.tw/linux/apache.htm
Apache Server 的個案討論
Apache Http Server 使用
mod_dav - Apache HTTP Server
Apache Http Server 使用
apache http server 防止盜連的方法
Apache HTTP Server 与 Tomcat 的三种连接方式介绍
Apache HTTP Server 与 Tomcat 的三种连接方式介绍
Apache HTTP Server 与 Tomcat 的三种连接方式介绍
Apache HTTP Server 与 Tomcat 的三种连接方式介绍
小探Subversion Server 之 Apache配置
ASP.NET中树形图的实现,jsp,asp,sql,php,mysql,server,apache,iis,tomcat,oracle,java,linux,dns
正确配置和维护Apache WEB Server 安全性
asp.net 2.0下嵌套masterpage页的可视化编辑,jsp,asp,sql,php,mysql,server,apache,iis,tomcat,oracle,java,linux,dns
asp.net 2.0下嵌套masterpage页的可视化编辑,jsp,asp,sql,php,mysql,server,apache,iis,tomcat,oracle,java,linux,dns
apache的mod_cache_JackBillow
apache 有用的 mod
apache的rotatelogs使用手记
apache
SQL Server 2000企业版安装教程,jsp,asp,sql,php,mysql,server,apache,iis,tomcat,oracle,java,linux,dns
生产环境中的一些web server(主要是三巨头apache, nginx, lighttpd)
使用Apache的rewrite技术
apache和tomcat的区别
Apache创始人:Apache的成功应该归功于开源
Apache配置详解(最好的APACHE配置教程)1