2011-11-14 19 views
7

我希望能够使用C以外的别名如何:\ XAMPP-范围,因为在XAMPP的dev的机器设置别名

alias /opt "C:\opt" 

有在XAMPP一些设置,我不能牵制,试图改变用户,添加等,其中没有任何工作,这是一个纯粹的开发环境,所以这里最亲吻的解决方案是什么?

问候, //牛逼

回答

11

你需要有两个条目它,别名和目录。您的/opt/lampp/etc/extra/httpd-xampp.conf(source)中应该有一个条目,看起来像下面的代码块之一。一些配置选项已经改变,更多信息可以在文档中找到Upgrading to 2.4 from 2.2

Apache 2.2的配置:

Alias /opt/ "C:/opt/" 
<Directory "C:/opt"> 
     Options Indexes FollowSymLinks MultiViews ExecCGI 
     AllowOverride All 
     Order allow,deny 
     Allow from all 
</Directory> 

的Apache 2.4配置:

Alias /opt/ "C:/opt/" 
<Directory "C:/opt"> 
     Options Indexes FollowSymLinks MultiViews ExecCGI 
     AllowOverride All 
     Require all granted 
</Directory> 

别名段定义你的虚拟目录和实际目录。在此示例中,website.com/opt/(或localhost/opt)将指向硬盘驱动器上的C:/ opt。

目录部分定义了apache应该如何处理从这个位置提供的内容,它将像任何其他目录条目一样工作,所以从根条目复制一个并使它们相似可能是一个好主意。

这还需要启用mod_alias,请检查httpd-xampp.conf并确保其条目未被注释掉。对conf文件进行任何更改后,您将需要重新启动apache以使更改生效。

+0

这个链接已经死了恐怕 – pluke

+1

我把它更新为全部文本,看起来类似于下面。我还在Xampp论坛上找到了配置文件的位置,并添加了一个链接以供参考。 – Melikoth

+0

这花了我很长时间,但缺少一条线。正确的解决方案应该包括“要求所有授权”才能工作。 – Veehmot

0

最后,易如:

Alias /opt "C:/opt" 
<Directory "C:/opt"> 
    Options +Indexes 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
</Directory> 
+0

你在哪里存储这个条目?在Apache中它在 Apache24/conf/extra/alias.conf 但是这个文件在xampp中不存在 – pluke

2

你会想要做的第一件事是添加一个别名目录到您的XAMPP安装:

C:\xampp\apache\conf\alias 

接下来,你会需要更改你的Apache配置文件。你可以找到它下

C:\xampp\apache\conf\httpd.conf 

一旦你打开httpd.conf中,添加以下到结束并保存。现在

Include "conf/alias/*" 

,对于每一个别名要创建你需要创建一个文件是这样的:

<directory "c:\users\foo\programming\dev"> 
    # 
    # 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.2/mod/core.html#options 
    # for more information. 
    # 
    Options Indexes FollowSymLinks Includes ExecCGI 

    # 
    # 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. 
    #  Order allow,deny 
    Allow from all 
</Directory> 

Alias /dev "C:\users\foo\programming\dev" 

在这个例子中,别名叫做“开发”并将其指向“ C:\ users \ foo \ programming \ dev“

最后,您需要重新启动Apache服务器,就是这样。

+2

尽管这个链接可能回答这个问题,但最好在这里包含答案的基本部分并提供链接供参考。如果链接页面更改,则仅链接答案可能会失效。 – djv

+0

好点。我会去做。谢谢 –