how to configure on Apache proxy (SSL conection) to Tomcat - apache

I am new in Apache's world, and I need to connect a server (Ubuntu system ) located in my DMZ area to a Tomcat server (Windows server System) in my network. So I wrote on my Ubuntu Apache /etc/apache2/sites-available/default-ssl:
<VirtualHost *:443>
<Location /example>
ProxyPass http://tomcatIP:8080/example/
ProxyPassReverse https://mydomain/example/
</Location>
</VirtualHost>
I restart my Apache and on the browser doesnt display anything, however if i choose source code I can see all the php, javascript, html code.
I checked the log from Apache and there are a lot logs like this:
AH00128: File does not exits: /var/html/...
I checked my firewall and everything is correct. I don`t know why my apache doesn't search on Tomcat server. Do I need more code? on apache.conf?
Many thanks for the help

You need to configure AJP Connector on Web-Server and on Tomcat Application Server.
https://tomcat.apache.org/tomcat-4.0-doc/config/ajp.html

Afer read documentation, I checked the Tomcat configuration and I watched that it wasn't the "tipical" Tomcat, it completly customized for Servicedesk software, and after many tries and fails I couldn't do anything, finally the costumer service told me that is impossible an Apache connection. ¬¬
Thanks anyway!!

Related

Apache httpd.conf - route request to different port

I have a CentOs 7.1 with Apache httpd running on port 9000.
So if i type in my browser: http://192.168.56.101:9000/ I see the Apache Testing 123 Page.
I also have a GitLab Server running on port 8888, but this port is closed by the firewall.
I want that Apache redirects traffic to http://192.168.56.101:9000/gitlab internally to the GitLab server.
I have done this in my Apache config file /etc/httpd/conf/httpd.conf:
<VirtualHost *:9000>
ProxyPass /gitlab http://192.168.56.101:8888/users/sign_in
ProxyPassReverse /gitlab http://192.168.56.101:8888/users/sign_in
</VirtualHost>
When users browse to http://192.168.56.101:9000/gitlab the login page appears (css seems broken though), but when logging in this appears:
Not Found
The requested URL /users/sign_in was not found on this server.
Is this something that is configurable with Apache and if so how?
Do I need to use some sort of Url-Rewriting, if yes which and how to get started?
All the links in gitlab will presume you are pointing at the original server.
So you need to look at mod_proxy_html to also replace these links in the HTML:
https://httpd.apache.org/docs/2.4/mod/mod_proxy_html.html

Deploying a Web2py App

I'm deploying a Web2py application via CentOS VPS on Bluehost with Apache pre-installed.
I've manually gone through the process of installing Web2py, Python, and some additional software in /home/username. When I run the following command in /home/username/web2py to launch Web2py via Rocket at port 8000 python web2py.py --ip xxx.xx.xx.xx --port=8000, I and others can successfully visit http://xxx.xx.xx.xx/8000 or http://mywebsite.com/8000 to view Web2py's welcome screen (and ultimately my application).
However, when I attempt to run python web2py.py --ip xxx.xx.xx.xx --port=80, so that I can visit the application at http://xxx.xx.xx.xx/ or http://mywebsite.com/, I receive the following error:
ERROR:Rocket.Errors.Port80:Socket in use by other process and it won't share
Apache is already running on port 80. Ultimately, I'd like the user to visit the application at http://xxx.xx.xx.xx/ or http://mywebsite.com/. How do I make this happen in my current configuration WITHOUT using one step production deployment described here: http://web2py.com/book/default/chapter/13#Apache-setup?
I'm interested in how to do this in each of the following three ways:
1) Using the pre-installed Apache server already on port 80.
2) Using the Web2py's built-in Rocket server on port 80, thus adjusting the system so that the pre-installed Apache server is ignored and port 80 opened.
3) Using the built-in Rocket server on another port, say 8000, but doing so in such a way that the user can still access the site and all of its functionality by visiting http://xxx.xx.xx.xx/ or http://mywebsite.com/. THis means that they would NOT need to append 8000 to the url (as in http://xxx.xx.xx.xx/8000 or http://mywebsite.com/8000).
Thank you.
A port can only be used by one application. So you can't run both an Apache and a web2py server on the same port (e.g. port 80).
All ports from 0 to 1024 are privileged ports. This means only a superuser can assign an application to the port. Typically this can also produce sayed error message, that the port is in use (even if there is no application listening to the port)
Case 1 and 3 - Using the Apache-Server but not mod_wsgi:
I assume you don't want to use modwsgi or any wsgi on you apache. Than you have to proxy you application with mod_proxy:
<VirtualHost *:80>
Alias / /users/www-data/web2py/applications
### serve static files directly
<LocationMatch "^/static/.*">
Order Allow, Deny
Allow from all
</LocationMatch>
### proxy all the other requests
<Location "/">
Order deny,allow
Allow from all
ProxyRequests off
ProxyPass http://localhost:8000/
ProxyPassReverse http://localhost:8000/
ProxyHTMLURLMap http://127.0.0.1:8000/ /
</Location>
You have to adjust the Locations to your actual setup and the web2py server has to be running.
Case 2 - Not using apache:
In this case you have to stop the apache server and start you application with a privileged account (e.g. root):
sudo python web2py.py --ip xxx.xx.xx.xx --port=80
Hope this helps ;)

Apache fresh installation ssl

I've installed Apache on CentOS and have not enabled SSL, and yet I get the following error.
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please. Hint:
https://192.168.1.50/ Apache/2.2.15 (CentOS) Server at 192.168.1.50
Port 443
The page I was testing it is a simple html page.
I did not make many changes to the fleshly installed Apache. The only things I edited are IPTABLES config file to allow LAN access on port 80 and the httpd.conf file to change document root.
I've installed Apache before(on Fedora), but didn't have this problem.
Thank you.
I managed to find the problem. I found a sll.conf file that contains all of the SSL configuration lines. The SSL was enabled by default, its weird. It is located in /etc/httpd/conf.d/ and a simple
<VirtualHost _default_:443>
SSLEngine off
</VirtualHost>
did the trick.

Connect apache and coldfusion 10 using mod_proxy_ajp

I'm trying to setup my local development environment and I'm only missing one piece of the puzzle.
I was able to successfully install the following on my Mac OSX 10.7.5 x86_x64
XAMPP - http://www.apachefriends.org/en/xampp-macosx.html
ColdFusion 10 - Developer Edition
Both are running fine. I was able to pull up localhost (Apache) and localhost:8500 (ColdFusion) - my ajp connector port is 8012
Now I want to be able to pass the request to my ColdFusion from Apache using mod_proxy_ajp.
I created an index.cfm file on the wwwroot/cf directory of ColdFusion, enabled the NameVirtualHost and created a VirtualHost directive in Apache that looks like this:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
<Location "/cf">
Allow from all
ProxyPass ajp://localhost:8012/
</Location>
</VirtualHost>
After restarting everything, I get a 503 error.
Any help or pointers is much appreciated.
Thanks!
check your CF logs:
{cf_root}/cfusion/logs/coldfusion-error.log
You probably have something like this in the log:
org.apache.coyote.ajp.AjpProcessor getRealPathFromServer
SEVERE: Error in getRealPathFromConn
java.io.IOException: Socket read failed
So mod_proxy_ajp is passing the request to Tomcat, but Tomcat can't read it.
Have you tried configuring with mod_jk instead?
http://helpx.adobe.com/coldfusion/kb/coldfusion10-apache-manual-connector-configuration.html
Might not be the way you want to configure it, but it should get you up and running.

Tomcat Manager with mod_proxy and ROOT web application

Our application runs in Tomcat6 and we're proxying all requests from Apache to Tomcat via mod_proxy. that proxy config looks like:
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
<Location />
Order deny,allow
Allow from all
</Location>
Our application is also deployed as ROOT. I think that this is causing issues when attempting to get to the /manager URL but I'm not 100% sure and unclear on how I can verify this. Can anyone give me some pointers on how to resolve this? I'd like to use the manager app for remote deployments from jenkins.
That configuration will route all traffic to Tomcat, including requests to /manager. The way to confirm this is to look at Tomcat's access log that should show the same requests as httpd's access log.
Try http:// localhost/manager/html
It should work on both ports.