共享httpd.conf

发布于 2024-08-24 00:53:53 字数 727 浏览 5 评论 0原文

我正在尝试在多台 OS X 计算机上共享单个 httpd.conf 文件。我使用 Dropbox 来管理文件并使其可供两台计算机使用。我遇到的问题是 httpd.conf 文件必须从我的主目录中的某个位置加载虚拟主机配置文件,并且每台计算机上的路径都不同。

我尝试引用 ${HOME} 变量,但是,虽然它在手动启动 Apache 时有效,但当 Apache 尝试在启动时启动时,该变量不可用。我通过询问这个问题了解到了这一点。

下一步,我创建了 ~/.MacOSX/environment.plist 并创建了一个名为 HTTPD_CONF_BASE_PATH 的新环境变量,它指向每台计算机上正确的主目录(例如/Users/rwilkerson)。不幸的是,Apache 似乎不喜欢我的自定义变量。它被系统识别——我可以echo它就好了——但是如果引用该值,Apache将不会在启动时手动启动。

Apache 对它所承认的环境变量那么敏感吗?我这里还有其他选择吗?我没有什么可以尝试的事情了。

I'm trying to share a single httpd.conf file across multiple OS X machines. I'm using Dropbox to manage the file and make it available to both machines. The problem I'm having is that the httpd.conf file has to load virtual host config files from a location within my home directory and the path is different on each machine.

I tried referencing the ${HOME} variable, but, while it works when starting Apache manually, that variable isn't available when Apache tries to boot at startup. I learned that by asking this question.

As a next step, I created ~/.MacOSX/environment.plist and created a new environment variable I called HTTPD_CONF_BASE_PATH that points to the proper home directory on each machine (e.g. /Users/rwilkerson). Unfortunately, Apache doesn't seem to like my custom variable. It's recognized by the system--I can echo it just fine--but Apache will not start at boot or manually if that value is being referenced.

Is Apache that sensitive to which environment variables it will acknowledge? Do I have any other options here? I'm out of things that I can think to try.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忆沫 2024-08-31 00:53:53

问题是 apache 没有以“您”身份运行,因此它无法知道您指的是哪个主文件夹。

最好的办法是将配置文件保存在两台计算机上的相同路径中。如果文件绝对必须位于您的主文件夹中,您可以使用符号链接来指向常见的位置。

The problem is that apache isn't running as "you" so it has no way of knowing which home folder you mean.

Your best bet is to keep the config files at the same path on both machines. If the files absolutely have to live in your home folder, you can use a symbolic link to point from somewhere common.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文