如何使Apache正确绑定到虚拟主机
我一直在努力建立一个网站,并且在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.
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:
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要纠正站点问题,请将DocumentRoot更改为
Next,您不应允许Apache显示目录内容。添加以下行:
apache目录列表
您应下一步定义默认页面。假设默认页面为index.html,请将此行添加到上一个目录 e节:
将index.html更改为您使用的任何内容,例如用于PHP的PHP使用index.php或home.php等。
To correct the site issue, change DocumentRoot to
Next, you should not allow Apache to display directory contents. Add these lines:
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:
Change index.html to whatever you are using, e.g. for PHP use index.php or home.php, etc.
我弄清楚了它不起作用的原因。这是因为我将文件的文件夹上传到服务器,而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.