具有MAMP的虚拟主机 [英] Virtual Host with MAMP

查看:145
本文介绍了具有MAMP的虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MAMP上安装了Drupal 8。
我的 Apache端口:80,Nginx端口:80和MySQL端口:8889

I installed Drupal 8 with MAMP.
My MAMP preference number for Apache Port : 80 , Nginx Port: 80 and MySQL Port: 8889

etc / hosts 文件,我添加

127.0.0.1 mmcast.test

在httpd.conf文件中,

In httpd.conf file,

Listen 80 

并取消注释以下行。

and uncomment the following line.

# Virtual hosts
Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

httpd-vhosts.conf 文件中,

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /Applications/MAMP/htdocs
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    ServerName mmcast.test
    DocumentRoot "/Applications/MAMP/htdocs/mmcast"
</VirtualHost>

当我呼叫该站点时,键入 mmcast.test:8888 ,然后也可以尝试使用 mmcast.test:80
但是,没有任何效果! :(

有人可以帮帮我吗?
我一直在尝试此问题,但仍然无法解决。

When I call the site, I type mmcast.test:8888 and also try with mmcast.test:80.
However, nothing works! :(
Could someone help me please?
I've been trying this problem and still cannot solve.

推荐答案

对于Drupal 8,您需要使用不同的设置来创建虚拟主机。

For Drupal 8 you need different settings for creating virtual host.

以下是需要为虚拟主机添加的代码段:

Here is the snippet that needs to be added for virtual host:

<VirtualHost *:8888>
  DocumentRoot "/Applications/MAMP/htdocs/site-name/web"
  ServerName local.site-name.com
  <Directory /Applications/MAMP/htdocs/site-name/web/>
    Options Indexes FollowSymLinks
    AllowOverride all
    RewriteEngine On
    RewriteBase /
  </Directory>
</VirtualHost>

所以我访问本地站点为

local.site-name.com:8888

我使用的默认端口为8888。因此,根据上面的代码段。

I have used default port, which is 8888. So above snippet is according to it.

您可以从 Drupal.org

这篇关于具有MAMP的虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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