使用 MAMP 的虚拟主机 [英] Virtual Host with MAMP

查看:33
本文介绍了使用 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 文件中,

In httpd-vhosts.conf file,

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>

所以我访问我的本地站点

So I access my local site as

local.site-name.com:8888

我使用了默认端口,即 8888.所以上面的代码片段是根据它.

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

您也可以从 Drupal.org 引用此链接.

You can refer this link from Drupal.org as well.

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

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