JSP file is served as plain/text, when TOMCAT is behind an APACHE server - apache

I'm running in a strange problem. I have a project based on MAVEN. When I run the project directly from my computer for testing it, using mvn tomcat7:run, my website display is correct. When I upload it to my distant Tomcat server, that is accessed through the JK Apache Tomcat connector, the JSP page is served as a text file. In response headers, I can see Content-Type:text/plainwhich is almost strange, and I'm suspecting the Apache server is adding it because of some erroneous configuration.
Any idea where to look, to fix this problem ?

Related

Howto run mod-mono and php on same apache webserver

I've successfully implemented mod-mono and apache webserver on a Centos 8 distro.
I've also installed PHP 7.2 on the server and the configuration looks ok on eye inspection.
However, the webserver is not executing the PHP files, but serving them for download.
If i go to http://example.com - it runs the website in MONO space
If I go to http://example.com/info.php - it gives me the PHP file for downloading. It makes me think that it tries to run the php file through mono and fails, so gives it to me for download instead forwarding it to PHP for execution.
Is it possible to run both PHP and MONO code on same apache webserver?
If yes, what could be the tricks to have it working ?
Many thanks.
Actually having a separate PHP website and also MONO websites in same apache server was working. However I though things were not working since I tried to run the PHP file from within the MONO-handled virtualhost ... so no need for clarifications.

Nginx is Slower than Apache downloading main.bundle.js

I have an Angular2 app that I've been developing for a bit now. Locally I run an Nginx server but the deployment server is using Apache. To unify things I worked to move the deployment server to Nginx but I am getting extremely slow results with Nginx.
Apache loads in ~5 seconds (1.1MB transferred)
Nginx loads in 16-20 seconds (5MB transferred)
These are both on the same server pointing to the exact same directory. The actual size of main.bundle.js is 4470365 main.bundle.js so it seems Nginx is loading the entire file.
How is Apache able to download only 737K?
You can check for the features enabled in both the files with nginx and apache by clicking on the exact file in Inspect element Network Tab. Then go to Headers and then Response Headers as illustrated in the attached image.
Check if the gzip compression is enabled in any one of the server. That is the only reason for lesser file size.

The http://localhost:8080/axis2 link does not work

Hello fellow programmers,
I have to get axis2 (version 1.7.2) working in Tomcat (version 8.0.33) but here I encounter a annoying problem. I have followed the steps in the tutorial (from the axis.apache website) until the point of checking the link mentioned in the topic title.
I have downloaded the Axis2.war file and placed it in the webapps folder in the tomcat home directory (/opt/tomcat).
When I start tomcat using the startup.sh file and visit the homepage it all seems to work. visiting the link http://localhost:8080/ will show me the text:
It works !
If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations! etc etc
But then when I visit http://localhost:8080/axis2 I get:
HTTP Status 404 - /axis2
type Status report
message /axis2
description The requested resource is not available.
Apache Tomcat/8.0.28 (Ubuntu)
When I run the .startup file and at the same time look at my webapps folder I see that the .war folder is extracted and makes the axis2 folder appear, thus it works until there at least.
Does someone has an idea of what could be wrong here?
PS: I am using Ubuntu.
if your deploy axis2.war, port must be the same at the Apache Tomcat and Axis2 8080, check file tomcat_dir\conf\server.xml

grails.app.context being ignored deploying to Tomcat

I have an Apache server proxying all traffic from mainhost.com/subdirectory to someec2instance/subdirectory. When I start Apache and hit someec2instance.com, I get the ROOT war page. That works fine. If I deploy my app as ROOT.war, everything works fine form someec2instance.com.
However, when I access mainhost.com/subdirectory, all the asset urls and link_to urls are wrong and point to mainhost.com instead of mainhost.com/subdirectory.
I've set grails.app.context and confirmed via application.properties that the correct grails.env is being set.
Why isn't grails.app.context being respected when I deploy as ROOT.war? I would expect the site to be accessible on someec2instance.com/context, but it's like it ignore grails.app.context entirely.
The reason is doesn't work is that those settings are for running locally, not when deployed as a WAR file. When you use the tomcat or jetty plugin in run-app we configure the container to make it look like it's running an "exploded" war (similar to when a WAR gets unpacked to the file system by various servers). Since the container is running in embedded mode, it's easy to configure it programmatically as needed.
But when you deploy a WAR file there's nowhere near as much configurability. In run-app the build logic of Grails starts the server, configures it, and deploys the app, but a WAR file deployed to a "real" server is managed by the server and not the other way around.

Netbeans project 404 + apache localhost XAMPP

I've created a web project in Netbeans. When I run it, it starts a glassfish server, and everything works fine (I don't understand why or how, but it works).
I also have XAMPP installed on my mac. I copied my netbeans project folder to my user sites folder, and ran my apache server with XAMPP.
I can access the sites index, but whenever I try to use a servlet, I get a 404, object not found.
Does this have something to do with glassfish web xml file? Servlet Mapping? Is there a new apache web xml file that I must create for it to work on apache server?
I can paste code if you need it.
Thanks!!!
Apache Server is for php based application and for running java based web project you have to install apache tomcat or glassfish as you have done previously where the servlet container is available.