Archive for the ‘work’ Category

Apache下配置sandbox

Posted in work with tags , , , .

May 8, 08

No reply

今天google了一下, 把长久以来很想做的一个apache VirtualHost配置搞定了.

基本功能是这样的: 在地址栏输入sandbox能访问我建在原来localhost下的document root/sandbox文件夹.

分开来,包括了两大部分: 将sandbox解析到本机(http request给Apache); 然后Apache根据server name返回内容.

解析sandbox

当你往浏览器地址栏里面输入http://sandbox/的时候, 浏览器会把sandbox作为一个域名, 查询与之相关联的IP. 浏览器首先去查看系统的host文件有没有列出这个域名. 如果有, 将直接返回host文件里的IP. 没有, 则要找网络连接里面配置的DNS服务器查询IP.

我要达到的目的让浏览器查询sandbox时返回本机IP 127.0.0.1, 最简单的办法就是修改host文件啦.

host文件在我的系统(Vista)的C:\Windows\System32\drivers\etc内. 用记事本打开, 在文件末端添加一行:

127.0.0.1    sandbox

这样浏览器就会将sandbox指向127.0.0.1.

配置Apache

浏览器把http请求顺利的转到了本机, 接下来应该是Apache忙活了. 为了让Apache找到sandbox对应的本地目录, 就需要配置一个VirtualHost.  我的配置是这样的:

NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "F:/web"
ServerName localhost
</VirtualHost>

<VirtualHost 127.0.0.1:80>
DocumentRoot "F:/web/sandbox"
ServerName sandbox
</VirtualHost>

具体配置说明去看文档, 这里就不讲了. 上面配置的意思就是127.0.0.1下域名为localhost的内容在F:/web, 而sandbox内容在F:/web/sandbox.

到这里, 浏览器就能收到Apache的输出, 显示存在F:/web/sandbox下的内容了.

未解决的问题

host文件似乎不能用将域名绑定到一个端口上去. 比如我尝试下面的配置就失败了:

127.0.0.1:8000    jira

http://jira/不会连接到我的Tomcat上, 而是很”智能”地跑到jira.com去了-_-!!!也许这种问题需要其它的解决方案咯.


Apr 13, 08

3 replies

Since the web is waiting for the XHTML2 standard, we can notice that the trend of web page markup is heading to the pure XML direction. Though XHTML2 might need a long time to be published, we should be prepared. What shall we do now? Switching to XHTML1.1 now would be the best practice since:

  1. It’s pure XML, which is similar to XHTML2.
  2. It is supported by current common browsers.

Using XHTML1.1 will let you be familiar with pure XML, and makes it much easier to change to XHTML2 in the future.

I decided to switch to XHTML1.1 (from XHTML1.0 traditional) today. While cleaning up my web pages, I found some tips which might be helpful for web you developers:

Read the rest of this entry »


Many things, no time

Posted in work with tags .

Mar 22, 08

No reply

最近忙到没法抽时间写几篇blog, 的确有点夸张. 留个印记, 以便回头看看叹口气(可能或许maybe炫耀一下也难说).

日程上有一个issue是写一个JIRA的安装教程, 还有一些新鲜的东东, 比如M$和DELL搞的(product)RED, android下的bluetooth, HID, 还有一些新鲜的ideas, 崔健的Rock, 包括刚刚从taobao淘到的黑曜石手链和Diesel jeans… 太多太多

ADC剩下的时间不多了, 能用的idea才刚刚出来, 看来最近也不可能抽时间写blog了. 再过半个月, 又要忙工作的事了… 算来算去, 要熬到哪天才能安心的写篇blog呢? 唉, 50h/d的幻想又一次浮出脑门~~~


Mar 1, 08

No reply

With an exciting news from engadget, a big touch screen is shaped into the new android prototype mobile phone.

Unfortunately because of GFW, I can’t see that live demo video. But from the picture I can see it’s running the newly released m5 build of android OS. I think the release of m5 is based on the test on that mobile phone – the screen size and menu layout in SDK m5 is the same as this phone.

So, it’s coming soon~~~ I gonna hurry up with my ADC project.


Feb 25, 08

1 reply

今天把wordpress升级到了2.5beta1, 中文又是一片乱码, 唉,万恶的8-host, 万恶的GBK.

不得已,再去翻wp-db.php. 却发现代码改了,添加了对DB_CHARSET的支持,使用了:

$this->charset = DB_CHARSET;
...
$this->query("SET NAMES '$this->charset'");

来定义数据库连接的编码了

于是马上在我的wp-config.php中添加了一行:

define('DB_CHARSET','UTF8');

F5了一下, 果然好用, 哈哈.以后不需要改wp的core, 直接在config文件中定义就可以了. 方便,方便,相当地方便.