ITeye博客

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

wangyanlong0107 · 2012-09-16 11:11 · Apache http Server · 企业架构 · Markdown

最近打算看看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. # AllowOverride controls what directives may be placed in .htaccess files.
  17. # It can be "All", "None", or any combination of the keywords:
  18. #   Options FileInfo AuthConfig Limit
  19. #
  20. AllowOverride All
  21. #
  22. # Controls who can get stuff from this server.
  23. #
  24. # Online --> Require all granted
  25. #   onlineoffline tag - don't remove
  26. Order Allow,Deny
  27. Allow from all
  28. Require local
  29. </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. # Alias: Maps web paths into filesystem paths and is used to
  10. # access content that does not live under the DocumentRoot.
  11. # Example:
  12. # Alias /webpath /full/filesystem/path
  13. #
  14. # If you include a trailing / on /webpath then the server will
  15. # require it to be present in the URL.  You will also likely
  16. # need to provide a <Directory> section to allow access to
  17. # the filesystem path.
  18. #
  19. # ScriptAlias: This controls which directories contain server scripts.
  20. # ScriptAliases are essentially the same as Aliases, except that
  21. # documents in the target directory are treated as applications and
  22. # run by the server when requested rather than as documents sent to the
  23. # client.  The same rules about trailing "/" apply to ScriptAlias
  24. # directives as to Alias.
  25. #
  26. ScriptAlias /cgi-bin/ "cgi-bin/"
  27. Alias /cocos2dhtml5/ "D:/Coding/cocos2d-html5-v0.5.0-alpha/"
  28. </IfModule>

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

 

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

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。