macos 如何在 OSX 中更改 xampp htdocs 目录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8060533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to change xampp htdocs directory in OSX?
提问by jela
I want to change XAMPP's htdocs directory. I followed the instructions to create a virtual host from this question:
我想更改 XAMPP 的 htdocs 目录。我按照说明从这个问题创建了一个虚拟主机:
Make XAMPP/Apache serve file outside of htdocs
在 htdocs 之外制作 XAMPP/Apache 服务文件
this works fine on Windows 7, however when I try it on OSX, going to mysite.local just loads the xampp splash screen (mysite.local/xampp/index.html). I have restarted the web server. My virtual host declared in httpd-vhosts.conf is:
这在 Windows 7 上运行良好,但是当我在 OSX 上尝试时,转到 mysite.local 只会加载 xampp 启动画面 (mysite.local/xampp/index.html)。我已经重新启动了 Web 服务器。我在 httpd-vhosts.conf 中声明的虚拟主机是:
<VirtualHost *:80>
DocumentRoot Users/username/Documents/sitename.com
ServerName sitename.localhost
<Directory Users/username/Documents/sitename.com>
Order allow,deny
Allow from all
</Directory>
采纳答案by jela
solved by editing httpd.conf
通过编辑 httpd.conf 解决
I have got this working. As per http://www.acwolf.com/blog/2009/February/xampp-virtual-hosts-mac, in OSX it is necessary to make two changes to httpd.conf, first, uncomment
我有这个工作。根据http://www.acwolf.com/blog/2009/February/xampp-virtual-hosts-mac,在 OSX 中,有必要对 httpd.conf 进行两处更改,首先,取消注释
#Include /Applications/xampp/etc/extra/httpd-vhosts.conf
and second, change the user from nobody to the username you use to log into OSX. You may also need to delete your browser's cache.
其次,将用户从 nobody 更改为您用于登录 OSX 的用户名。您可能还需要删除浏览器的缓存。
回答by Antonio Max
Open the following file in a text editor.
在文本编辑器中打开以下文件。
/Applications/XAMPP/xamppfiles/etc/httpd.conf
/Applications/XAMPP/xamppfiles/etc/httpd.conf
Search for "DocumentRoot", if the line below has a #
in front of it than it's commented remove it and change the path between the quote
搜索“DocumentRoot”,如果下面的行#
前面有一个而不是注释,则将其删除并更改引号之间的路径
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
Now search for the line below and change the path between the quotes to your needs.
现在搜索下面的行并根据需要更改引号之间的路径。
<Directory "/Applications/XAMPP/xamppfiles/htdocs">
NOTICE: Paths similar to ~/
won't work use the absolute path.
注意:类似于 的路径~/
将无法使用绝对路径。
回答by Josephus87
If you forward to a directory in your user root, then:
如果您转发到用户根目录中的目录,则:
DocumentRoot "/Users/<your username here>/Sites"
<Directory "/Users/<your username here>/Sites">
回答by Milad
Other than the answers mentioned above, I also had to change the line in XAMPP/xampfiles/etc/httpd.conf
where it mentions username. the default was set to daemon
and I changed it to my username; so there was no permission problem.
除了上面提到的答案之外,我还必须更改XAMPP/xampfiles/etc/httpd.conf
提到用户名的行。默认设置为daemon
,我将其更改为我的用户名;所以没有权限问题。