【转】Apache服务器httpd.conf别名文件夹的配置

最近打算看看cocos2d-html5,原因是想做个小东西,使用cocos2d,但是C++和Objective-C都不是最熟练,虽然JS也很弱,但是相比之下上手配置会简单一点,所以就使用了html5版本

在参照了http://www.gamefromscratch.com/post/2012/06/04/Cocos2D-HTML5-tutorial-1-Getting-set-up-and-running.aspx这里的Cocos2D HTML5教程以后,按第一步配置了本地的Apache服务环境,但是毕竟要把文件内容都放到C盘制定的www目录下不是很爽(个人不太喜欢在C盘放系统有关之外的东西),正好在工作中有看到过可以配置映射目录,所以尝试了一下,虽然步骤可能不规范,有多余的东西,但是至少改了以后成功了,下面是要改的部分,仅作为记录用

 

1. 搜索Directory这个标签,默认的c:/wamp/www/目录已经被设为了允许访问权限,所以我们把整个标签复制一份下来

 

其他代码   收藏代码
  1. <Directory "c:/wamp/www/">  
  2.     #  
  3.     # Possible values for the Options directive are "None""All",  
  4.     # or any combination of:  
  5.     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews  
  6.     #  
  7.     # Note that "MultiViews" must be named *explicitly* --- "Options All"  
  8.     # doesn't give it to you.  
  9.     #  
  10.     # The Options directive is both complicated and important.  Please see  
  11.     # http://httpd.apache.org/docs/2.4/mod/core.html#options  
  12.     # for more information.  
  13.     #  
  14.     Options Indexes FollowSymLinks  
  15.   
  16.     #  
  17.     # AllowOverride controls what directives may be placed in .htaccess files.  
  18.     # It can be "All""None", or any combination of the keywords:  
  19.     #   Options FileInfo AuthConfig Limit  
  20.     #  
  21.     AllowOverride All  
  22.   
  23.     #  
  24.     # Controls who can get stuff from this server.  
  25.     #  
  26.     # Online --> Require all granted  
  27.       
  28.     #   onlineoffline tag - don't remove  
  29.     Order Allow,Deny   
  30.    
  31.     Allow from all   
  32.       
  33.     Require local  
  34.   
  35. </Directory>  

 改写第一行中的目录地址,这是你要映射的地址,同事再看最后的三行,这应该是关于权限的配置,我没有修改(具体代表的意义和这个文件的意义有大神知道麻烦给我普及一下,万分感谢)

 

2.继续搜索IfModule alias_module 找到这个标签,从名字上来判断,这个就是别名映射的模块了

 

其他代码   收藏代码
  1. <IfModule alias_module>  
  2.     #  
  3.     # Redirect: Allows you to tell clients about documents that used to   
  4.     # exist in your server's namespace, but do not anymore. The client   
  5.     # will make a new request for the document at its new location.  
  6.     # Example:  
  7.     # Redirect permanent /foo http://www.example.com/bar  
  8.   
  9.     #  
  10.     # Alias: Maps web paths into filesystem paths and is used to  
  11.     # access content that does not live under the DocumentRoot.  
  12.     # Example:  
  13.     # Alias /webpath /full/filesystem/path  
  14.     #  
  15.     # If you include a trailing / on /webpath then the server will  
  16.     # require it to be present in the URL.  You will also likely  
  17.     # need to provide a <Directory> section to allow access to  
  18.     # the filesystem path.  
  19.   
  20.     #  
  21.     # ScriptAlias: This controls which directories contain server scripts.   
  22.     # ScriptAliases are essentially the same as Aliases, except that  
  23.     # documents in the target directory are treated as applications and  
  24.     # run by the server when requested rather than as documents sent to the  
  25.     # client.  The same rules about trailing "/" apply to ScriptAlias  
  26.     # directives as to Alias.  
  27.     #  
  28.     ScriptAlias /cgi-bin/ "cgi-bin/"  
  29.     Alias /cocos2dhtml5/ "D:/Coding/cocos2d-html5-v0.5.0-alpha/"  
  30. </IfModule>  

 在这个模块的最后 添加上要映射的别名路径 格式是Alias /你要映射成的名字/ "你要映射的源目录"

 

3. 按以上更改好以后保存,重启服务,以我为例,我就可以通过192.168.1.2/cocos2dhtml5/ 访问到我D盘下Coding文件夹中cocos2d....那个文件夹中的内容了

猜你喜欢

转载自bigdragon.iteye.com/blog/1679339