简体   繁体   English

JSP在Linux EC2上不起作用

[英]jsp not working on linux ec2

I have set up an Amazon Linux EC2. 我已经设置了Amazon Linux EC2。 I am very new to it, but everything I want is almost set up. 我对此很陌生,但是我想要的一切几乎都已设置好。 I have a domain pointed, elastic IP, PHP/Apache/MySQL. 我有一个域指向的,弹性IP,PHP / Apache / MySQL。 I am also wanting to run Java on this instance as well, which I assume is possible. 我也想在此实例上运行Java,我认为这是可能的。 All my php stuff works, but when I hit a .jsp page, it looks like simple HTML. 我所有的PHP东西都可以用,但是当我点击.jsp页面时,它看起来像简单的HTML。

I log into my instance through the console, and get these: 我通过控制台登录到实例,并获得以下信息:

[ec2-user@ip-* ~]$ java -version
java version "1.7.0_25"         
OpenJDK Runtime Environment (amzn-2.3.10.3.29.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)`

echo $PATH                                       
/usr/local/bin:/bin:/user/bin:/usr/local/sbin:/usr/sbin:/sbin:opt/aws/bin:/home/ec2-user/bin:/usr/lib/jvm/java/bin

and when I hit my_domain:8080 I get the tomcat page. 当我点击my_domain:8080时,我得到了tomcat页面。

So I know Java is installed, and Tomcat is running. 因此,我知道已安装Java,并且Tomcat正在运行。 What else am I missing? 我还想念什么?

My .jsp file looks like this: 我的.jsp文件如下所示:

<%@page contentType="text/html" pageEncoding="UTF-8"%>                                       
<!DOCTYPE html>                                       
<html>                                       
    <head>                                       
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">                                       
        <title>JSP Page</title>                                       
    </head>                                       
    <body>                                       
        <h1><% out.println("Hello World!");%></h1>                                       
    </body>                                       
</html>

This is what my browser displays: 这是我的浏览器显示的内容:

<@page contentType="text/html" pageEncoding="UTF-8"%> <% out.println("Hello World!");%>

Anyone know what I need to fix this so PHP and JAVA will both work? 有人知道我需要解决此问题,以便PHP和JAVA都可以工作吗?

Wow.. yep @fmodos was correct. 哇...是的@fmodos是正确的。 I've been so use to PHP I dropped the .jsp file in my www folder of apache instead of my webapps folder of tomcat. 我已经习惯了PHP,所以将.jsp文件放在apache的www文件夹中,而不是tomcat的webapps文件夹中。 Der. 叔叔

I also needed to give give my ec2-user permissions in order to FTP files into it. 我还需要给ec2-user权限,以便将FTP文件输入其中。

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

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