如何在带有MAMP的Google云端硬盘中使用Apache虚拟主机

时间:2017-04-27 10:21:03

标签: macos apache google-drive-api mamp

编辑我的 local-development.conf 文件,我可以使用Dropbox而不是Google云端硬盘(因为我认为文件夹名称中有空格)。

<Directory "/Users/myusername/Google Drive/CODE PROJECTS/vhosts/">
AllowOverride All
</Directory>

# Named Virtual Host
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog /Users/myusername/Google Drive/CODE PROJECTS/logs/access.log vcommon
ErrorLog /Users/myusername/Google Drive/CODE PROJECTS/logs/errors.log
UseCanonicalName Off
VirtualDocumentRoot /Users/myusername/Google Drive/CODE PROJECTS/vhosts/%0

我试过逃避:

CustomLog /Users/myusername/Google\ Drive/CODE\ PROJECTS/logs/access.log vcommon
ErrorLog /Users/myusername/Google\ Drive/CODE\ PROJECTS/logs/errors.log
UseCanonicalName Off
VirtualDocumentRoot /Users/myusername/Google\ Drive/CODE\ PROJECTS/vhosts/%0

错误日志告诉我&#34; Google \&#34;不是文件。

所以我试了一下引号,确保它们不是卷曲引号:

CustomLog "/Users/myusername/Google Drive/CODE PROJECTS/logs/access.log" vcommon
ErrorLog "/Users/myusername/Google Drive/CODE PROJECTS/logs/errors.log"
UseCanonicalName Off
VirtualDocumentRoot "/Users/myusername/Google Drive/CODE PROJECTS/vhosts/"%0

我尝试在我的Mac上为这两个文件夹创建一个别名,但这并没有解决问题。

显然,重命名Google云端硬盘文件夹不是一个选项,我也希望保留其他文件夹名称。

1 个答案:

答案 0 :(得分:0)

解决方案是在引号中包含%0变量。

<Directory "/Users/myusername/Google Drive/CODE PROJECTS/vhosts/">
AllowOverride All
</Directory>

# Named Virtual Host
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog "/Users/myusername/Google Drive/CODE PROJECTS/logs/access.log" vcommon
ErrorLog "/Users/myusername/Google Drive/CODE PROJECTS/logs/errors.log"
UseCanonicalName Off
VirtualDocumentRoot "/Users/myusername/Google Drive/CODE PROJECTS/vhosts/%0"