简体   繁体   English

Amazon EC2 如何托管我自己的内容? 坚持进行工作测试 apache 页面

[英]Amazon EC2 How Do I host My Own Content? Stuck on having a working test apache page

I am using this guide: http://codingthis.com/platforms/linux/how-to-host-simple-content-with-amazon-elastic-cloud-computing-ec2/我正在使用本指南: http://codingthis.com/platforms/linux/how-to-host-simple-content-with-amazon-elastic-cloud-computing-ec2/

I have a folder named public_html in my /home/ec2-user directory with a test.html file.我的 /home/ec2-user 目录中有一个名为 public_html 的文件夹,其中包含一个 test.html 文件。

What I have done so far:到目前为止我做了什么:

sudo yum -y install httpd php
sudo chkconfig httpd on
chmod 755 /home/ec2-user  (I HAVE NO IDEA WHAT THIS DOES)
sudo nano /etc/httpd/conf/httpd.conf
  (changed DocumentRoot to DocumentRoot /home/ec2-user/public_html)

TLDR: How do I make it load my content (my html file) instead of the apache test page TLDR:如何让它加载我的内容(我的 html 文件)而不是 apache 测试页面

EXTRA:额外的:

I have a security group enabled for my instance with rules:我为我的实例启用了一个具有规则的安全组:

ICMP Allow ALL
TCP Allow ALL
UDP Allow ALL
TCP port 80 (Http) 

Chmod755/directory/directory/etc.. Will give access to that directory. chmod755/directory/directory/etc..将授予对该目录的访问权限。 So if your website is in the folder *home/ec2-user/public_html* you would then need to give access to that directory.因此,如果您的网站位于文件夹 *home/ec2-user/public_html* 中,则您需要授予对该目录的访问权限。 Example: chmod 755 home/ec2-user/public_html示例:chmod 755 home/ec2-user/public_html

I was having the same issue.我遇到了同样的问题。 I fixed it by changing the permissions on the ec2-user directory like so:我通过更改 ec2-user 目录的权限来修复它,如下所示:

chmod +x home/ec2-user

This give execution permissions to everyone on your user directory.这为您的用户目录中的每个人提供执行权限。

isnt your document root public_html instead of www?您的文档根目录不是 public_html 而不是 www? so why did u put ur pages under www directory?那么为什么你把你的页面放在 www 目录下呢?

If you have no content in the DocumentRoot that you configured then the default Apache install will show you that page instead of yours.如果您配置的 DocumentRoot 中没有内容,则默认的 Apache 安装将显示该页面而不是您的页面。 Also, check the DirectoryIndex configuration to make sure that if you're using index.php or default.html or something else that this is configured as well.此外,检查 DirectoryIndex 配置以确保您使用的是 index.php 或 default.html 或其他配置。 It defaults to index.html默认为 index.html

I had the same problem.我有同样的问题。 All I have to do was just restarting the ec2 to apply the changes.我所要做的就是重新启动 ec2 以应用更改。 - takes me 2h:( - 需要我 2 小时:(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM