社会性形式的网站

Thursday, January 6th, 2005 12:51am

我使用过这些社会性形式的网站,感觉很好

还有什么可以推荐补充的?



What do you want to do with your life?

Wednesday, January 5th, 2005 01:37pm

大家新年有什么计划可以去这里看看。又是一个社会化软件的东西,蛮有趣的。



用mod_rewrite与mod_userdir配置apache虚拟主机

Tuesday, January 4th, 2005 11:13pm

mod_userdir可以让linux机器上的用户都有一个虚拟主机,缺省目录为~/public_html。配合suexec,其还可以使各个虚拟主机的cgi程序以各自的用户身份执行。

但是mod_userdir的形式为http://servername/~username/,而我们希望可以通过不同的域名访问不同的虚拟主机。

因此我试着使用mod_rewrite将http://domainname/的访问转换为userdir的形式。apache的配置脚本httpd.conf相关内容如下(假设用户目录为/home/username)

LogFormat "%{VHOST}e %V %h %l %u %t %r %>s %b %{Referer}i %{User-Agent}i" vhost
CustomLog logs/vhosts_access_log vhost

RewriteEngine on
#RewriteLog /usr/local/apache2/logs/rewrite_log
#RewriteLogLevel 9

RewriteMap lowercase int:tolower
RewriteMap vhost txt:/home/vhost.map

RewriteCond %{ENV:VHOST} ^$
RewriteCond %{REQUEST_URI} ^/~([^/]+)
RewriteCond ${lowercase:%1} ^(.+)$
RewriteRule ^.*$ $0 [PT,E=VHOST:%1]

RewriteCond %{ENV:VHOST} ^$
RewriteCond %{HTTP_HOST} !^$
RewriteCond ${lowercase:%{HTTP_HOST}} ^(.+)$
RewriteCond ${vhost:%1} ^(.+)$
RewriteRule ^.*$ $0 [E=VHOST:%1]

RewriteCond %{ENV:VHOST} !^$
RewriteCond %{REQUEST_URI} !^/~
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteRule ^/(.*)$ /~%{ENV:VHOST}/$1 [PT]

RewriteCond %{ENV:VHOST} !^$
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /~%{ENV:VHOST}/$1 [PT,T=application/x-httpd-cgi]

RewriteCond %{REQUEST_URI} ^/~[^/]+/cgi-bin/
RewriteRule ^.*$ $0 [PT,T=application/x-httpd-cgi]

<Directory /home/*/public_html/>
    Options Indexes FollowSymLinks Includes
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<Directory /home/*/public_html/cgi-bin>
    Options ExecCGI
    SetHandler cgi-script
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

vhost.map内容为

# domain name       # username
example.vhost       example
www.example.vhost   example
erning.vhost        erning
www.erning.vhost    erning

这样,启动apache后,就可以通过 http://www.example.vhost/ 访问 http://servername/~example/。 (设置了hosts文件,使.vhost后缀的域名可以使用)

Technorati Tags: , ,



Google
 
Web erning.net