1. Linux Setup
1.1 Installation
wget -P tar/ http://apache.justdn.org/httpd/httpd-2.X.XX.tar.bz2tar jxvf tar/httpd-2.X.XX.tar.bz2
cd httpd-2.X.XX
./configure –prefix=/usr/local/apache
make -j 10
make install
1.2 Config setting
cp support/apachectl /etc/init.d/httpd
chmod 755 /etc/init.d/httpd
Add following to the head "/etc/init.d/httpd" : 修改/etc/init.d/httpd:前面几行改成如下样子.
1 2 3 4 5 6 7 | # Startup script for the Apache Web Server # chkconfig: 35 85 15 # description: Apache is a World Wide Web server. It is used to serve \ # HTML files and CGI. # processname: httpd # pidfile: /usr/local/apache/log/httpd.pid # config: /usr/local/apache/conf/httpd.conf |
Run
chkconfig –add httpd
Configuration "/usr/local/apache/conf/httpd.conf"
ServerName yourservername.yourdomainname:80
#在/root/.bash_profile 中的PATH****后加上:/usr/local/apache/bin
2. 用Apache的.htaccess文件增加用户认证
1 2 3 4 5 6 7 | Alias /test"/var/www/test" <directory "/var/www/test"> Options Indexes MultiViews AllowOverride AuthConfig #表示进行身份验证 Order allow,deny Allow from all </directory> |
3.名字型虚拟主机
1 2 3 4 5 6 7 8 9 10 11 | NameVirtualHost 61.152.210.22 <virtualhost 61.152.210.22> ServerAdmin eric@bizeasy.cn ServerName www.bizeasy.cn DocumentRoot /home/eric/public_html/igenus </virtualhost> <virtualhost 61.152.210.22> ServerAdmin eric@dyzq.com ServerName mail.dyzq.com DocumentRoot /usr/local/httpd/htdocs/ </virtualhost> |
4.Other
在这里,最好是在apache的配置中增加默认文件类型的cache机制,即利用apache的expires模块,新增类似如下几行:
1 2 3 4 5 6 7 | ExpiresActive On ExpiresByType text/html "access plus 10 minutes" ExpiresByType text/css "access plus 1 day" ExpiresByType image/jpg "access 1 month" ExpiresByType image/gif "access 1 month" ExpiresByType image/jpg "access 1 month" ExpiresByType application/x-shockwave-flash "access plus 3 day" |
5.Install Apache HTTP Server 2.20 by using FreeBSD (Ports)
5.1
cd /usr/ports/www/apache22
make install clean




Popular Posts