gpt4 book ai didi

apache - 如何在 ubuntu 13.10 中创建虚拟主机

转载 作者:行者123 更新时间:2023-12-04 19:03:28 26 4
gpt4 key购买 nike

我正在使用 ubuntu 13.10 操作系统和 LAMP、Apache 2.4。

我想在 apache 上创建一个虚拟主机。我尝试了一些代码,但没有成功。

进行了以下修改。但它不起作用。

首先我改变了HostnameLookups offHostnameLookups onetc\apache2\apache2.conf文件。然后我添加了以下代码,

<VirtualHost *:80>
ServerName local.scholarships.theiet.in
DocumentRoot /home/www/my_project/public_html
<Directory path_to_code_base/public>
Options -Indexes
Require all granted
DirectoryIndex index.php
AllowOverride All
</Directory>
</VirtualHost>

重启 apache 后我跑了 http://localhost/ .该网站未加载。

运行时如何加载我的站点 http://localhost/

最佳答案

以下是在 Apache/Ubuntu 上创建虚拟主机的方法:

我的 000-default.conf 文件:

<VirtualHost *:80>
DocumentRoot /var/www/php/frbit/l4blog/public/
<Directory /var/www/php/frbit/l4blog/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
ServerName l4blog
</VirtualHost>

请注意,我创建了 服务器名 ,这是我的新主机的名称。

您可以像这样在/etc/hosts 文件中添加新主机名:
127.0.0.1   your_host_name

为了不输入长网址,例如代替
http://localhost/path/directory/file/...

你可以直接输入 您的主机名 在地址栏中:
your_host_name

关于apache - 如何在 ubuntu 13.10 中创建虚拟主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22033812/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com