iCloud Drive上的macOS Sierra Sites文件夹如何本地化? [英] macOS Sierra Sites folder on iCloud Drive how to localhost?

查看:63
本文介绍了iCloud Drive上的macOS Sierra Sites文件夹如何本地化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将我的Sites文件夹移动到iCloud Drive,并从主文件夹对一个Sites别名进行了符号链接,以便于在终端等中使用,以便于使用.这对于带有Webrick服务器的Rails应用程序非常有用.

I have moved my Sites folder to iCloud Drive and symlinked a Sites alias from the home folder, for ease of use, in Terminal etc. This works neatly for my rails apps with Webrick server.

现在,我想将其与Apache一起用于非Rails站点.

Now I would like to use it with Apache, for non rails Sites.

如何设置localhost/〜username以在iCloud Drive中使用站点?我得到您无权访问此服务器上的/〜username/."

How can I set localhost/~username to use Sites in iCloud Drive? I get "You don't have permission to access /~username/ on this server."

(我知道如果Sites文件夹(不是别名)位于主文件夹中,该怎么做并成功.我检查了设置.它可以工作.)

(I know how to and succeed if the Sites folder - not an alias - is in the home folder. I checked the setup. It works.)

推荐答案

我将用于网站开发的站点文件夹放在iCloud Drive中.我的台式计算机和笔记本电脑始终自动与最新的开发文件夹同步.为此,您必须编辑httpd.conf文件和专用主机文件.在httpd.conf文件中,您必须更改运行Apache的用户,以便它可以访问iCloud驱动器.

I put my sites folder for my website development in my iCloud Drive. Both my desktop computer and my laptop are always in sync with the latest development folder automatically. To do this, you have to edit your httpd.conf file and your private host files. In the httpd.conf file, you must change the user that is running Apache so that it can access the iCloud drive.

在httpd.conf中找到用户"和组"的行并进行

In httpd.conf find the lines for the User and Group and edit them:

<IfModule unixd_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User <Edit in your username without the brackets>
Group admin

</IfModule>

现在在虚拟主机文件中:httpd-vhosts.conf-编辑网站的导演位置.iCloud目录的位置以/Users/您的用户名/Library/Mobile Documents/com〜apple〜CloudDocs开头,并且必须加引号,因为目录名中为空.

Now in the Virtual Hosts File: httpd-vhosts.conf - edit your director location for your website. The location of the iCloud directory begins with: /Users/yourusername/Library/Mobile Documents/com~apple~CloudDocs and must be quoted because of the blank in directory name.

<VirtualHost *:80>
    ServerAdmin webmaster@domainname.com
	DocumentRoot "/Users/yourusername/Library/Mobile Documents/com~apple~CloudDocs/Sites/YourDomainsRootDirectory"
	<Directory "/Users/yourusername/Library/Mobile Documents/com~apple~CloudDocs/Sites/YourDomainsRootDirectory">
	   AllowOverride All
	   Options Indexes MultiViews FollowSymLinks
	   Require all granted
	</Directory>
    ServerName yourdomainname.com
    ServerAlias dev.yourdomainname.com
    ErrorLog "/private/var/log/apache2/yourdomainname.com-error_log"
    CustomLog "/private/var/log/apache2/yourdomainname.com-access_log" common 
</VirtualHost>

然后重新启动Apache

Then restart Apache

这篇关于iCloud Drive上的macOS Sierra Sites文件夹如何本地化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆