【转】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/目录已经被设为了允许访问权限,所以我们把整个标签复制一份下来
其他代码
[*]<Directory "c:/wamp/www/">
[*] #
[*] # Possible values for the Options directive are "None", "All",
[*] # or any combination of:
[*] # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
[*] #
[*] # Note that "MultiViews" must be named *explicitly* --- "Options All"
[*] # doesn't give it to you.
[*] #
[*] # The Options directive is both complicated and important. Please see
[*] # http://httpd.apache.org/docs/2.4/mod/core.html#options
[*] # for more information.
[*] #
[*] Options Indexes FollowSymLinks
[*]
[*] #
[*] # AllowOverride controls what directives may be placed in .htaccess files.
[*] # It can be "All", "None", or any combination of the keywords:
[*] # Options FileInfo AuthConfig Limit
[*] #
[*] AllowOverride All
[*]
[*] #
[*] # Controls who can get stuff from this server.
[*] #
[*] # Online --> Require all granted
[*]
[*] # onlineoffline tag - don't remove
[*] Order Allow,Deny
[*]
[*] Allow from all
[*]
[*] Require local
[*]
[*]</Directory>
改写第一行中的目录地址,这是你要映射的地址,同事再看最后的三行,这应该是关于权限的配置,我没有修改(具体代表的意义和这个文件的意义有大神知道麻烦给我普及一下,万分感谢)
2.继续搜索IfModule alias_module 找到这个标签,从名字上来判断,这个就是别名映射的模块了
其他代码
[*]<IfModule alias_module>
[*] #
[*] # Redirect: Allows you to tell clients about documents that used to
[*] # exist in your server's namespace, but do not anymore. The client
[*] # will make a new request for the document at its new location.
[*] # Example:
[*] # Redirect permanent /foo http://www.example.com/bar
[*]
[*] #
[*] # Alias: Maps web paths into filesystem paths and is used to
[*] # access content that does not live under the DocumentRoot.
[*] # Example:
[*] # Alias /webpath /full/filesystem/path
[*] #
[*] # If you include a trailing / on /webpath then the server will
[*] # require it to be present in the URL. You will also likely
[*] # need to provide a <Directory> section to allow access to
[*] # the filesystem path.
[*]
[*] #
[*] # ScriptAlias: This controls which directories contain server scripts.
[*] # ScriptAliases are essentially the same as Aliases, except that
[*] # documents in the target directory are treated as applications and
[*] # run by the server when requested rather than as documents sent to the
[*] # client. The same rules about trailing "/" apply to ScriptAlias
[*] # directives as to Alias.
[*] #
[*] ScriptAlias /cgi-bin/ "cgi-bin/"
[*] Alias /cocos2dhtml5/ "D:/Coding/cocos2d-html5-v0.5.0-alpha/"
[*]</IfModule>
在这个模块的最后 添加上要映射的别名路径 格式是Alias /你要映射成的名字/ "你要映射的源目录"
3. 按以上更改好以后保存,重启服务,以我为例,我就可以通过192.168.1.2/cocos2dhtml5/ 访问到我D盘下Coding文件夹中cocos2d....那个文件夹中的内容了
页:
[1]