标签:apache

浏览模式: 标准 | 列表 | 图文
gogs 如何不使用端口进行访问

gogs 如何不使用端口进行访问

gogos 默认是 3000端口,如果你本身已经有了其他WEB服务,比如apache,当然不可能同时占用80端口,这时候就可以利用apapche的proxy功能。如果你是apt-get 安装 的apache,就方便了,debian/ubuntu 都支持a2ensiate,a2enmod这样的小脚本。你只要打开a2enmod proxy proxy_http就行了,然后新建一个site加入以下配置

<VirtualHost *:80>
ServerAdmin test@test.com
ServerName yoursitename
ProxyRequests off
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
ErrorLog ${APACHE_LOG_DIR}/yoursitename.log
LogLevel warn
</VirtualHost>
是不是很简单,这时候你用supervisor启动后就可以通过WEB访问了.不过这时候有具小缺点,那就是如果你killall gogs进程的话,你会发现再也启动不了了.看启动的LOG会告诉你3000端口被占用,用netstat -an|grep 3000,发现有N个进程都是在CLOSE_WAIT的情况,这时候用: echo $(netstat -anp|grep 127.0.0.1:3000 |awk '{print $7}') 发现,全是apache2占着这些进程.

怀疑刚才在强杀gogs进程的时候,apache因为开着proxy导致刚刚向3000端口发起请求就挂起,导致异常关闭所以一直卡住(以前用nginx的做反代的时候也有类似问题,只要客户机挂了,nginx必须 重启),所以我重启了一下apache,立刻发现gogs启动成功.

至此,如果要 重启gogs最好是/etc/init.d/supervisor restart ,如果不正常就再重启一下apache...

OK,问题全部解决

MAMP Pro 3.05 on Mavericks updated to Yosemite - Apache does not start

MAMP Pro 3.05 on Mavericks updated to Yosemite - Apache does not start

今天新版发布,立刻升级,结果就这MAMP玩意不能启动了。启动的时候直接报错:

dyld: Symbol not found: _iconv Referenced from: /usr/lib/libmecabra.dylib Expected in: /Applications/MAMP/Library/lib/libiconv.2.dylib in /usr/lib/libmecabra.dylib /Applications/MAMP/Library/bin/apachectl: line 80: 2799 Trace/BPT trap: 5 $HTTPD "$
开始没注意,是以为80端口没有足够的权限,再仔细一看,怎么是动态 链接库出问题了?难道是补丁没更新?
于是打开Xcode,果然说有必须要安装的组件等着我更新。更新完后再启动,还是这个问题。
不得已Google一下,果然在stackoverflow上有人有提出了类似的问题,并且被解决了:http://stackoverflow.com/questions/25139599/mamp-pro-3-05-on-mavericks-updated-to-yosemite-apache-does-not-start,解决的方法居然非常简单,只要将MAMP目录下的envvars改名成_envvars就可以了:
mv /Applications/MAMP/Library/bin/envvars /Applications/MAMP/Library/bin/_envvars
记得不要CP,cp没用。。估计会优先检查这个envvars,如果文件存在就用这里面的环境变量了。改名后就不管了
如果觉得有用,记得去上面的链接帮别人点个赞。哈
开发中的一些注意事项

开发中的一些注意事项

开发中遇到一些问题,值得记住,所以我记录了一下
1、在项目中为了取得泛域名的前缀网址,这个前缀是指定的a,b,c三种,如果前缀不在这三种之内,默认为a,在apache下面的时候,建了一个*.test.neatstudio.com的泛域名指到vhost中。然后用偷懒的方法list(explode(".",$_SERVER['SERVER_NAME']))就取到了a,b,c,因为在apapche中,$_SERVER['SERVER_NAME']就是实际的a.test.neatstudio.com。然而到了nginx下行不通了。在nginx下,$_SERVER['SERVER_NAME']居然还是test.neatstudio.com,最后打印$_SERVER变量,发现$_SERVER['SERVER_HOST']才是泛域名的a.test.neatstudio.com。在此做一个记录

2、chown处理大量小文件时,你就等着CPU标高100%吧。这个问题很痛苦,但没办法

3、我晶。我记得要写一个很重要的笔记 的。我TMD又忘了。被第一个问题打断了。我晶啊,算了。等想起来再说吧

yii:Apache and Nginx configurations

yii的urlmanager可以让项目在访问的时候隐藏index.php,也可以以更优雅的urlrewrite方式来显示,但这一切需要一些配置,在apache上的配置上就相对比较简单,直接参考wordpress的官方配置就完了,但其实很久以来,一直都没有人写过nginx下的配置。大家都是在根据wordpress配置来更改的,比如lnmp项目中,就是:

location / {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}

不过,这两天在看官方guide的文档,原来这些问题,官方已经提供方案了:http://yii.neatcn.com/doc/guide/1.1/en/quickstart.apache-nginx-config#nginx

1. Apache

Yii is ready to work with a default Apache web server configuration. The .htaccess files in Yii framework and application folders restrict access to the restricted resources. To hide the bootstrap file (usually index.php) in your URLs you can add mod_rewrite instructons to the .htaccess file in your document root or to the virtual host configuration:

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php

2. Nginx

You can use Yii with Nginx and PHP with FPM SAPI. Here is a sample host configuration. It defines the bootstrap file and makes yii catch all requests to unexisting files, which allows us to have nice-looking URLs.

server {
set $host_path "/www/mysite";
access_log /www/mysite/log/access.log main;

server_name mysite;
root $host_path/htdocs;
set $yii_bootstrap "index.php";

charset utf-8;

location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ $yii_bootstrap?$args;
}

location ~ ^/(protected|framework|themes/\w+/views) {
deny all;
}

#avoid processing of calls to unexisting static files by yii
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
try_files $uri =404;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;

#let yii catch the calls to unexising PHP files
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}

fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;

#PATH_INFO and PATH_TRANSLATED can be omitted, but RFC 3875 specifies them for CGI
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
}

location ~ /\.ht {
deny all;
}
}

Using this configuration you can set cgi.fix_pathinfo=0 in php.ini to avoid many unnesessary system stat() calls.

粗心+jpeg 精度

粗心+jpeg 精度

jpeg大家都知道,它有一个精度的概念,一般如果我们用GD库做缩略图时,默认精度就是100,这时候压缩的图片还是和原来一样清晰,但事实 上我们不需要这样的清晰,毕竟在网页中72的dpi就足够了。所以当我们把精度设置为72时,尺寸会明显下载。下降的很厉害哦。
于是,我在我们目前的项目中用上了自动根据 URL生成了缩略图,指定了某个域名下的图片生成。但最终发现所生成的图片都是超级大,很让我意外,于是将精度调整为72,但效果仍然这样,没有变化,这是为什么呢?
排查了很多原因,都没有发现代码上有任何问题,最终在检查apache的conf文件时发现,我将某个serveralias写错了。我在多个域名中间用","分隔了,事实上多个域名应该是用空格分开。
那可能您又要说了,如果这个域名不存在,那岂不是会报错?是的,事实上就是错了,但。。。。我在默认的网站配置里也有一个自动生成缩图的配置,那个配置中,精度是100.所以,死活排查不出问题。

当然看到这里就知道,我的问题还是解决了。否则我就不可能在这里记录笔记了。
看过我博客的人都知道,我。。。粗心犯的错误太多了。哎。

Mac上禁止Apache开机启动

Mac上禁止Apache开机启动

前段时间在机器上装了apache+mysql+php,但最近越来越发现,耗电量高可能就是因为它,所以想禁用amp,看看是否这个原因。
mysql的话,在系统属性里有一个mysql,可以用来对它进行开启和关闭(还可以设定是否在启动系统的时候同时启动mysql)。可是apache就没有了。
嗯,虽然说在共享里有一个WEB共享可以设定打开与否,但目前状态下,本来就没有开启WEB共享,那怎么办?
于是乎:

sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist

unload之后,立刻就发现apache已经无法启动了。
当然,如果要启动它,就是load喽。这就不用多说了。

lnmp组件中sablog的配置纠错

lnmp组件中sablog的配置纠错

lnmp是现在相对比较容易和被大家所接受的一个套装。由于我用的是Sablog所以我在设定vhost的时候就选了sablog,但是告诉我第二行出错了。

仔细检查了一下,好象确实是有这个问题,一来好象是编码也有问题,二来它copy的规则有点象是discuz的规则,和sablog系统后台中的规则不一样。所以,我根据 sablog后台中的规则进行了修正,立刻正常了。
sablog的默认规则是支持apache的rewrite的。如下:

# BEGIN Sablog-X
RewriteEngine On
RewriteBase /
# 文章
RewriteRule ^show-([0-9]+)-([0-9]+)\.shtml$ index.php?action=show&id=$1&page=$2
# 分类
RewriteRule ^category-([0-9]+)-([0-9]+)\.shtml$ index.php?action=index&cid=$1&page=$2
# 只带月份的归档
RewriteRule ^archives-([0-9]+)-([0-9]+)\.shtml$ index.php?action=index&setdate=$1&page=$2
# 用户列表、高级搜索、注册、登陆
RewriteRule ^(archives|search|reg|login|index|links)\.shtml$ index.php?action=$1
# 全部评论、标签列表、引用列表 带分页
RewriteRule ^(comments|tagslist|trackbacks|index)-([0-9]+)\.shtml$ index.php?action=$1&page=$2
# END Sablog-X

注意那个.shtml,那是我自定义的URL后缀,所以你看我的博客的时候,都有这玩意。。。将就点了。说实话,我怀疑这个shtml对SEO有友好度,所以我才这么配置(纯属猜测)
改完后配置是这样的:

location / {

rewrite ^/show-([0-9]+)-([0-9]+)\.shtml$ /index.php?action=show&id=$1&page=$2 last;
rewrite ^/category-([0-9]+)-([0-9]+)\.shtml$ /index.php?action=index&cid=$1&page=$2 last;
rewrite ^/archives-([0-9]+)-([0-9]+)\.shtml$ /index.php?action=index&setdate=$1&page=$2 last;
rewrite ^/(archives|search|reg|login|index|links)\.shtml$ /index.php?action=$1 last;
rewrite ^/(comments|tagslist|trackbacks|index)-([0-9]+)\.shtml$ /index.php?action=$1&page=$2 last;
}

其实看到没,与apache下的配置很相像,只是在最前面加了 ^/ ,然后在指向的文件前加 /
同时在最后加 last;
嗯,就这样。。。灰常方便,你换了没?

转:apache一个优化小技巧

转:apache一个优化小技巧

determine the MaxClient

決定 web server 效能一個最重要的因素就是記憶體的量,而藉由調整 MaxClient,可以避免 Apache 產生過多無用的 child process。這個數字到底要調到多少,老實說也沒有一個標準答案,網路上大家比較建議的算法都是用機器有的記憶體和每個 child process 的 size 去做粗估。但事實上,要估計 apache child process 的 size 也不是一件容易的事,如果你用 ps aux 這個指令去看,出來的 VSZ or RSS value,其實都會把 shared memory 重覆記算(詳細內容請參考: Understanding memory usage on Linux , Memory usage determination with the ps command ),所以後來我採用的作法是:先將 MaxClent 設成一個比較小的值 (e.g. 30),然後再定期去看 error log 是否有 run out of clients 的情形,如果有的話,就再幫 MaxClients 加個 5。

原文来自:http://brooky.cc/2011/06/30/practical-guide-on-setup-wordpress-on-amazon-ec2-free-tier/

disable “AllowOverride”

理論上,AllowOverride 會造成 Apache 在路徑的每一層去找找看是否有 .htaccess 這個 file。
例如說:如果 virtual host 的設定是:

DocumentRoot /www/htdocs AllowOverride all

那任何一個 /index.html 的 request, Apache 都會試著去找 /.htaccess, /www/.htaccess, and /www/htdocs/.htaccess.
所以除非必要,是可以將 AllowOverride 設成 None.

但如果你用了 wordpress Pretty Permalinks”這個功能,那就會需要 rewrite rule 的功能。在這種情況下,可以考慮將 AllowOverride 的設定直接寫在 config 檔裡。

----------
上文中的链接:Memory usage determination with the ps command

The ps command can also be used to monitor memory usage of individual processes.

The ps v PID command provides the most comprehensive report on memory-related statistics for an individual process, such as:

  • Page faults
  • Size of working segment that has been touched
  • Size of working segment and code segment in memory
  • Size of text segment
  • Size of resident set
  • Percentage of real memory used by this process
The following is an example:
# ps v 
PID TTY STAT TIME PGIN SIZE RSS LIM TSIZ TRS %CPU %MEM COMMAND
36626 pts/3 A 0:00 0 316 408 32768 51 60 0.0 0.0 ps v

The most important columns on the resulting ps report are described as follows:

PGIN
Number of page-ins caused by page faults. Since all I/O is classified as page faults, this is basically a measure of I/O volume.
SIZE
Virtual size (in paging space) in kilobytes of the data section of the process (displayed as SZ by other flags). This number is equal to the number of working segment pages of the process that have been touched times 4. If some working segment pages are currently paged out, this number is larger than the amount of real memory being used. SIZE includes pages in the private segment and the shared-library data segment of the process.
RSS
Real-memory (resident set) size in kilobytes of the process. This number is equal to the sum of the number of working segment and code segment pages in memory times 4. Remember that code segment pages are shared among all of the currently running instances of the program. If 26 ksh processes are running, only one copy of any given page of the ksh executable program would be in memory, but the ps command would report that code segment size as part of the RSS of each instance of the ksh program.
TSIZ
Size of text (shared-program) image. This is the size of the text section of the executable file. Pages of the text section of the executable program are only brought into memory when they are touched, that is, branched to or loaded from. This number represents only an upper bound on the amount of text that could be loaded. The TSIZ value does not reflect actual memory usage. This TSIZ value can also be seen by executing the dump -ov command against an executable program (for example, dump -ov /usr/bin/ls).
TRS
Size of the resident set (real memory) of text. This is the number of code segment pages times 4. This number exaggerates memory use for programs of which multiple instances are running. The TRS value can be higher than the TSIZ value because other pages may be included in the code segment such as the XCOFF header and the loader section.
%MEM
Calculated as the sum of the number of working segment and code segment pages in memory times 4 (that is, the RSS value), divided by the size of the real memory in use, in the machine in KB, times 100, rounded to the nearest full percentage point. This value attempts to convey the percentage of real memory being used by the process. Unfortunately, like RSS, it tends the exaggerate the cost of a process that is sharing program text with other processes. Further, the rounding to the nearest percentage point causes all of the processes in the system that have RSS values under 0.005 times real memory size to have a %MEM of 0.0.
Note: The ps command does not indicate memory consumed by shared memory segments or memory-mapped segments. Because many applications use shared memory or memory-mapped segments, the svmon command is a better tool to view the memory usage of these segments.
-----------
第二篇:http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html

这篇文章来自blogspot,一般情况下打不开,所幸我用Read it later,直接用广本模式,让他帮我打开了。HOHO,有点长,慢慢看:

This entry is for those people who have ever wondered, "Why the hell is a simple KDE text editor taking up 25 megabytes of memory?" Many people are led to believe that many Linux applications, especially KDE or Gnome programs, are "bloated" based solely upon what tools like ps report. While this may or may not be true, depending on the program, it is not generally true -- many programs are much more memory efficient than they seem.

What ps reports
The ps tool can output various pieces of information about a process, such as its process id, current running state, and resource utilization. Two of the possible outputs are VSZ and RSS, which stand for "virtual set size" and "resident set size", which are commonly used by geeks around the world to see how much memory processes are taking up.

For example, here is the output of ps aux for KEdit on my computer:


USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
dbunker 3468 0.0 2.7 25400 14452 ? S 20:19 0:00 kdeinit: kedit

According to ps, KEdit has a virtual size of about 25 megabytes and a resident size of about 14 megabytes (both numbers above are reported in kilobytes). It seems that most people like to randomly choose to accept one number or the other as representing the real memory usage of a process. I'm not going to explain the difference between VSZ and RSS right now but, needless to say, this is the wrong approach; neither number is an accurate picture of what the memory cost of running KEdit is.

Why ps is "wrong"
Depending on how you look at it, ps is not reporting the real memory usage of processes. What it is really doing is showing how much real memory each process would take up if it were the only process running. Of course, a typical Linux machine has several dozen processes running at any given time, which means that the VSZ and RSS numbers reported by ps are almost definitely "wrong". In order to understand why, it is necessary to learn how Linux handles shared libraries in programs.

Most major programs on Linux use shared libraries to facilitate certain functionality. For example, a KDE text editing program will use several KDE shared libraries (to allow for interaction with other KDE components), several X libraries (to allow it to display images and copy and pasting), and several general system libraries (to allow it to perform basic operations). Many of these shared libraries, especially commonly used ones like libc, are used by many of the programs running on a Linux system. Due to this sharing, Linux is able to use a great trick: it will load a single copy of the shared libraries into memory and use that one copy for every program that references it.

For better or worse, many tools don't care very much about this very common trick; they simply report how much memory a process uses, regardless of whether that memory is shared with other processes as well. Two programs could therefore use a large shared library and yet have its size count towards both of their memory usage totals; the library is being double-counted, which can be very misleading if you don't know what is going on.

Unfortunately, a perfect representation of process memory usage isn't easy to obtain. Not only do you need to understand how the system really works, but you need to decide how you want to deal with some hard questions. Should a shared library that is only needed for one process be counted in that process's memory usage? If a shared library is used my multiple processes, should its memory usage be evenly distributed among the different processes, or just ignored? There isn't a hard and fast rule here; you might have different answers depending on the situation you're facing. It's easy to see why ps doesn't try harder to report "correct" memory usage totals, given the ambiguity.

Seeing a process's memory map
Enough talk; let's see what the situation is with that "huge" KEdit process. To see what KEdit's memory looks like, we'll use the pmap program (with the -d flag):


Address Kbytes Mode Offset Device Mapping
08048000 40 r-x-- 0000000000000000 0fe:00000 kdeinit
08052000 4 rw--- 0000000000009000 0fe:00000 kdeinit
08053000 1164 rw--- 0000000008053000 000:00000 [ anon ]
40000000 84 r-x-- 0000000000000000 0fe:00000 ld-2.3.5.so
40015000 8 rw--- 0000000000014000 0fe:00000 ld-2.3.5.so
40017000 4 rw--- 0000000040017000 000:00000 [ anon ]
40018000 4 r-x-- 0000000000000000 0fe:00000 kedit.so
40019000 4 rw--- 0000000000000000 0fe:00000 kedit.so
40027000 252 r-x-- 0000000000000000 0fe:00000 libkparts.so.2.1.0
40066000 20 rw--- 000000000003e000 0fe:00000 libkparts.so.2.1.0
4006b000 3108 r-x-- 0000000000000000 0fe:00000 libkio.so.4.2.0
40374000 116 rw--- 0000000000309000 0fe:00000 libkio.so.4.2.0
40391000 8 rw--- 0000000040391000 000:00000 [ anon ]
40393000 2644 r-x-- 0000000000000000 0fe:00000 libkdeui.so.4.2.0
40628000 164 rw--- 0000000000295000 0fe:00000 libkdeui.so.4.2.0
40651000 4 rw--- 0000000040651000 000:00000 [ anon ]
40652000 100 r-x-- 0000000000000000 0fe:00000 libkdesu.so.4.2.0
4066b000 4 rw--- 0000000000019000 0fe:00000 libkdesu.so.4.2.0
4066c000 68 r-x-- 0000000000000000 0fe:00000 libkwalletclient.so.1.0.0
4067d000 4 rw--- 0000000000011000 0fe:00000 libkwalletclient.so.1.0.0
4067e000 4 rw--- 000000004067e000 000:00000 [ anon ]
4067f000 2148 r-x-- 0000000000000000 0fe:00000 libkdecore.so.4.2.0
40898000 64 rw--- 0000000000219000 0fe:00000 libkdecore.so.4.2.0
408a8000 8 rw--- 00000000408a8000 000:00000 [ anon ]
... (trimmed) ...
mapped: 25404K writeable/private: 2432K shared: 0K

I cut out a lot of the output; the rest is similar to what is shown. Even without the complete output, we can see some very interesting things. One important thing to note about the output is that each shared library is listed twice; once for its code segment and once for its data segment. The code segments have a mode of "r-x--", while the data is set to "rw---". The Kbytes, Mode, and Mapping columns are the only ones we will care about, as the rest are unimportant to the discussion.

If you go through the output, you will find that the lines with the largest Kbytes number are usually the code segments of the included shared libraries (the ones that start with "lib" are the shared libraries). What is great about that is that they are the ones that can be shared between processes. If you factor out all of the parts that are shared between processes, you end up with the "writeable/private" total, which is shown at the bottom of the output. This is what can be considered the incremental cost of this process, factoring out the shared libraries. Therefore, the cost to run this instance of KEdit (assuming that all of the shared libraries were already loaded) is around 2 megabytes. That is quite a different story from the 14 or 25 megabytes that ps reported.

What does it all mean?
The moral of this story is that process memory usage on Linux is a complex matter; you can't just run ps and know what is going on. This is especially true when you deal with programs that create a lot of identical children processes, like Apache. ps might report that each Apache process uses 10 megabytes of memory, when the reality might be that the marginal cost of each Apache process is 1 megabyte of memory. This information becomes critial when tuning Apache's MaxClients setting, which determines how many simultaneous requests your server can handle (although see one of my past postings for another way of increasing Apache's performance).

It also shows that it pays to stick with one desktop's software as much as possible. If you run KDE for your desktop, but mostly use Gnome applications, then you are paying a large price for a lot of redundant (but different) shared libraries. By sticking to just KDE or just Gnome apps as much as possible, you reduce your overall memory usage due to the reduced marginal memory cost of running new KDE or Gnome applications, which allows Linux to use more memory for other interesting things (like the file cache, which speeds up file accesses immensely).

apache 404转发

apache 404转发

平时我们用apache的404转发,大多数是:
ErrorDocument 404 /404.html
但这样其实也只能做到404的提示信息,会更加人性化一一点,但事实上我们要做到几件事情
比如我的图片不存在,我转发后,会根据图片的URL自动生成一张,这一点行不行呢?
于是乎,利用404转发就势在必行了
ErrorDocument 404 /xxx.php
在PHP里写上
<?php
header("Location:http://xxx.xxx.com".$_SERVER['REQUEST_URI']);
?>
或许有人说,为什么我的不起作用呢?
嗯,在ErrorDocument中,如果用其他域名就不行了
比如说我ErrorDocument 404 http://xxx.xxx.com/xxx.php
在其他域名下的Xxx.php不要说$_SERVER['REQUEST_URI']取不到,连HTTP_REFERER也没有的。
所以,还是在自己当前的项目写一下文件 ,利用header转发一下才是最OK的

旧文:设置Apache 虚拟目录(Virtual Directory)

旧文:设置Apache 虚拟目录(Virtual Directory)

虚拟目录,其实真的设置起来很简单啦,只要参考一下默认的httpd-vhost.conf就知道了。
要知道/doc/其实就是指的虚拟目录 。
嗯,假设你的 Apache 文件根目录是:c:\htdocs\,你要设置一下别名为xxx的虚拟目录,它实际是指向c:\htdocs\yyy
那么在配置文件中就是这样写的:

Alias /xxx/ "C:/htdocs/yyy/"
<Directory "C:/htdocs/yyy">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>

OK,修改了配置文件以后,应重新启动 Apache Service。(Start --> All Programs --> Apache HTTP Server 2.2 --> Monitor Apache Servers --> Restart)

Apache Service 重启之后,该虚拟目录就生效了。

这时候,你在c:/htdocs/yyy目录下放一个test.html,然后通过浏览器访问 http://localhost/xxx/test.html,你就会发现刚才的设置生效了。
是不是很简单?其实就是这样的简单。。。