如何使Apache正确绑定到虚拟主机

发布于 2025-01-22 09:35:24 字数 635 浏览 3 评论 0原文

我一直在努力建立一个网站,并且在Ubuntu 20.04 LS VM上使用Apache。我的域配置为指向服务器,并设置了HTTPS并正常工作,但是每当我到达域时,我都会得到此视图。

我试图通过使用服务器名称标签来使域与虚拟主机绑定,但这是行不通的。这是我的配置文件: “ 我是运行服务器世界的新手,如果这个问题很愚蠢,我很抱歉:)。 让我知道我是否可以添加任何在这种情况下会有所帮助的东西。这是我唯一试图在此VM上托管的网站。另外,Apache认为图像中显示的文件夹不存在于文件系统中。我不知道这是否会影响任何事情,但是要在服务器上获取我的网站文件,我将所有文件下载到背包项目中。谢谢。

I have been working on setting up a website and I am using Apache on a Ubuntu 20.04 LS VM. I have the domain configured to point to the server and https is set up and working but whenever I go to the domain I get this view. Apache Server View

I have tried to get the domain to bind with the virtual host by using the server name tag but that is not working. This is my config file: Apache Config File
I am new to the world of running servers so sorry if this question is stupid:).
Let me know if I can add anything that would be helpful in this situation. This is the only website I am trying to host on this VM. Also, apache does not think that the folder shown in the image exists in the filesystem. I do not know if this would affect anything but to get my website files on the server I downloaded all the files into backpacking-project. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

捂风挽笑 2025-01-29 09:35:24

要纠正站点问题,请将DocumentRoot更改为

/var/www/backpacking-project/backpackingProject

Next,您不应允许Apache显示目录内容。添加以下行:

<Directory /var/www/backpacking-project/backpackingProject>
  Options -Indexes
</Directory>

apache目录列表

您应下一步定义默认页面。假设默认页面为index.html,请将此行添加到上一个目录 e节:

DirectoryIndex index.html

将index.html更改为您使用的任何内容,例如用于PHP的PHP使用index.php或home.php等。

To correct the site issue, change DocumentRoot to

/var/www/backpacking-project/backpackingProject

Next, you should not allow Apache to display directory contents. Add these lines:

<Directory /var/www/backpacking-project/backpackingProject>
  Options -Indexes
</Directory>

Apache Directory Listings

Next you should define the default page. Assuming the default page is index.html, add this line to the previous Directory section:

DirectoryIndex index.html

Change index.html to whatever you are using, e.g. for PHP use index.php or home.php, etc.

゛时过境迁 2025-01-29 09:35:24

我弄清楚了它不起作用的原因。这是因为我将文件的文件夹上传到服务器,而Apache在文件系统中没有识别它。我分别上传了有效的文件。

I figured out the reason why it was not working. It was because I uploaded a folder of my files to the server and apache did not recognize it in the filesystem. I uploaded the files separately that that worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文