【问题标题】:How to regain access to home directories through browser after MAMP-wordpress installation安装 MAMP-wordpress 后如何通过浏览器重新访问主目录
【发布时间】:2013-11-22 16:34:21
【问题描述】:

我最近通过带有根 URL 的 MAMP 在 Mac 上安装了 wordpress,例如 example.smt.els.com。 为此,我必须停止已经在运行的 apache 服务器,以便使用 MAMP 提供的服务器。

我的问题是,虽然网站现在运行没有问题,但没有用户可以通过 example.smt.els.com/~username 访问他们的主目录。

这些 /~username 页面在 wordpress 之前可以访问。访问我在根目录中创建的子文件夹没有问题(即 example.smt.els.com/bananas)

如果有任何帮助,我将不胜感激。

【问题讨论】:

    标签: wordpress macos apache mamp home-directory


    【解决方案1】:

    从 MAMP 运行的 apache 服务器的配置在下面完成

    /Applications/MAMP/conf/apache/
    

    需要做的第一件事是加载各个用户的配置文件。这可以通过取消注释加载文件 httpd-userdir.conf 的行来完成。因此,第一步是取消注释以下行:

    $ cat httpd.conf | grep httpd-userdir.conf
    Include /Applications/MAMP/conf/apache/extra/httpd-userdir.conf
    $ 
    

    现在,在目录 extra 下可以修改 httpd-userdir.conf 文件,以便加载您想要的选项。第一个观察是 MAMP 附带的 httpd-userdir.conf 有一行内容如下:

    UserDir public_html
    

    请注意,这不是 OS X 下的预期目录。因此,我建议更改该行并使其如下所示:

    UserDir Sites
    

    因为“Sites”是 OS X 下用于此目的的预期目录。否则,您应该通知系统用户您正在使用 public_html,就像在传统的 unix/linux 发行版中一样。

    同样,在 httpd-userdir.conf 文件的下方,您应该更改该行

    <Directory "/home/*/public_html">
    

    到

    <Directory "/Users/*/Sites">
    

    请注意,httpd-userdir.conf 的 MAMP 版本在这方面与随 OS X 一起安装的 apache 附带的默认 httpd-userdir.conf 文件不同,可以在 /etc/apache2/ 下找到额外的/ 。比较这两个文件并使用您喜欢的配置版本。就个人而言,我会选择 OS X 附带的默认配置,这意味着我会使用这样的配置:

    #
    # Users might not be in /Users/*/Sites, so use user-specific config files.
    #
    Include /private/etc/apache2/users/*.conf
    <IfModule bonjour_module>
           RegisterUserSite customized-users
    </IfModule>
    

    因为它为您的个人用户配置提供了更大的灵活性。

    【讨论】:

      猜你喜欢
      • 2012-10-21
      • 1970-01-01
      • 1970-01-01
      • 2018-07-13
      • 2017-04-03
      • 1970-01-01
      • 2016-07-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多