Calendar

2007年十二月
« 十一   一 »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Translator

Apache @ Linux&FreeBSD Setup

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文件增加用户认证

 
然后编辑httpd.conf, 添加 例:
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>
最后:注意".htaccess"的权限。
 

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

Click to continue reading

Coolcode: WordPress 代码高亮插件

推荐使用新的替代插件WP-CODEBOX代码高亮插件,支持多种语言、代码下载、复制到剪贴板、代码框收放及后台默认属性设置。

代码高亮的Plugin,现在可以支持WordPress默认的<code></code>标签并修改了一下字体和行高,这样看起来舒服多了!

本插件用法:

<code lang=”php” linenum=”off” download=”foo.php”>
  <div id=”foo”> 
  <?php
    function foo() {
      echo “Hello World!\\n”;
    }
    for (\$i = 0; \$i < 10 $i++) {
      foo();
    }
  ?>
  </div> 
</code>

说明:

linenum=”off” 表示不显示行号
download=”foo.php” 表示你的代码将可以以foo.php文件来下载

效果如下:

function foo() {
echo “Hello World!\\n”;
}
for (\$i = 0; \$i < 10 $i++) {
foo();
}
?>