使用 MAMP 的虚拟主机 [英] Virtual Host with 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屋!