EC2实例中是否可能包含CSS [英] Is it possible to have css in an ec2 instance
问题描述
使用AWS我创建了一个EC2实例,因为我希望能够执行php代码.当我将客户端代码放在/var/www/html文件夹中时,当我进入公共DNS时html代码会正常显示.虽然没有执行css.这些是我对CSS文件的权限
Using AWS I created an EC2 instance because I wanted to be able to execute php code. When I put my client side code in the /var/www/html folder, the html code comes up fine when I go to the public DNS. The css is not executed though. These are my permissions for my css file
-rw-r--r-- 1个ubuntu ubuntu 4236 Apr 4 00:08 home.css
这是我html中的head选项卡
and this is the head tab in my html
<head>
<link rel="stylesheet" href="../css/home.css"></link>
<meta charset="utf-8">
</head>
此链接说我可以使用称为S3浏览器的东西对于我的CSS,但这是否意味着我不能使用EC2实例?同样,根据我对S3的了解,它是一个 Windows应用程序,并且我正在使用MACOS.看起来s3仅适用于简单的静态网页.
This link says I can use something called an S3 browser for my css, but does this mean I can't use an EC2 instance? Also from what I've look up about S3, it's a windows application and I'm using MACOS. It also looks like s3 is only for simple static web pages.
推荐答案
您的CSS位置似乎不正确.假设HTML页面位于/var/www/html/index.html
.尝试将CSS的位置更改为/css/home.css
It looks like the location of your CSS is incorrect. Assuming the HTML page is located at /var/www/html/index.html
. Try changing the location of your css to /css/home.css
<head>
<link rel="stylesheet" href="/css/home.css"></link>
<meta charset="utf-8">
</head>
这篇关于EC2实例中是否可能包含CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!