I am using JBoss/Tomcat + Mysql cartridges.
I would like to serve static resources (css,js,images) using Apache and host those files outside the WAR.
I would also like to be able to use Apache to configure redirect rules etc. Is there a way to do that? Thanks
You can not edit the vhost for your application, nor access the apache configs for your application when using one of the java cartridges. An apache proxy sits in front of your application, but is not accessible by you. You would either need to run a second gear with the php cartridge and host your static assets there, or try using a third party CDN to host your static files (such as amazon s3 or cloudfront). But with just using one of the java cartridges on OpenShift Online, you can not configure it the way that you are trying to.
You can do this as below. Put images, js & Css folder in Virtualhost document root. And call tomcat with help of mod_proxy_ajp configuration listed below.
ProxyPass /images !
ProxyPass /js !
ProxyPass /css !
ProxyPass / ajp://localhost:9009/
ProxyPassReverse / ajp://localhost:9009/
Related
I'm starting from the bitnami jenkins stack. Everything is working perfectly with jenkins.
http://sample:8080/jenkins (works fine)
I'm trying to add additional directories to apache to proxy to nginx:
http://sample:8080/other_tool
I can get to the other_tool homepage, but references to that other tool break down because they are looking for http://sample:8080/relative_url rather than http://sample:8080/other_tool/relative_url
I can pull config settings from the necessary files as needed, but it is on an air-gapped network so wholesale posting would be a challenge
The apache conf looks like:
<Directory /other_tool>
ProxyPass http://localhost:9999
ProxyPassReverse http://localhost:9999
</Directory>
The nginx configuration is a standard "/" with root directory. I'm not as familiar with nginx so I can't recall the exact information off the top of my head. If needed I will provide it.
I could try to switch the jenkins hosting over to nginx, but I'm not sure that simplifies anything.
I can't open more ports on the machine. I can't use a subdomain as that would require additional DNS entries that I do not control.
Ideas or suggestions?
I'm trying to deploy a Grails 2.5.3 application on a Tomcat 7 server, running behind Apache (apache running on http://valkyrien.imada.sdu.dk:80). Tomcat is running on port 8080 and Apache virtualhost is setup like this:
ProxyPass /gcp http://127.0.0.1:8080/ nocanon
ProxyPassReverse /gcp http://127.0.0.1:8080/
ProxyPreserveHost on
The war is deployed as ROOT.war to Tomcat's /webapps/ directory.
The index page of my grails application is shown, but the links on the page along with the asset links are wrong. None of them are prefixed with /gcp/.
Example: The javascript asset for jQuery at the html file is:
<script src="/assets/jquery-8c9c0e26152ea554b3ed6c4390439134.js" type="text/javascript"></script>
Which will try to access the js file at <APACHE-URL>/assets/jquery-8c9c0e26152ea554b3ed6c4390439134.js even though the file is in fact available at <APACHE-URL>/gcp/assets/jquery-8c9c0e26152ea554b3ed6c4390439134.js. The same apply to any link to controllers and actions.
Adding any combination of the following to Config.groovy or application.properties does not change anything (as suggested by answers on StackOverflow):
grails.serverURL="http://valkyrien.imada.sdu.dk/gcp"
grails.app.context = "/gcp"
It seems like Grails ignores the serverURL properties. Any suggestions toward why this is not working?
Running without Apache is not an option.
Thanks!
Deploy your app not as ROOT.war but as gcp.war and updated properties
...or better use mod_jk for apache.
I am using Magnolia 5.4 and i am trying to provide proxy pass settings to magnolia pages using apache http server. And i have configured like this
ProxyPass /travel http://<ip address>:8080/magnoliaPublic/travel.html
ProxyPass /.resources/** http://<ip address>:8080/.resources/**
the travel configuration is working, but not giving images and css files. So need a configuration to load all images and files that have .resources in path. how can i achieve this? Thaks
I don't know how to load folders,but to load images you can use following configuration using ProxyPassMatch
ProxyPassMatch "^/(.*\.png)$" "http://<ip address>:8080/$1"
ProxyPassMatch "^/(.*\.jpeg)$" "http://<ip address>:8080/$1"
ProxyPassMatch "^/(.*\.jpg)$" "http://<ip address>:8080/$1"
ProxyPassMatch "^/(.*\.img)$" "http://<ip address>:8080/$1"
With the above configuration, the apache server forward the requests that have extensions .png, .jpeg, .jpg, .img to the specified url.
Refer http://httpd.apache.org/docs/trunk/mod/mod_proxy.html#proxypassmatch for more information
I have two problems in setting Proxypass. I have setup the Proxypass in my Apache settings.
for example:
ProxyPass / http://www.domainname.com:8080/
ProxyPassReverse / http://www.domainname.com:8080/
I have the ROOT webapp in my tomcat to handle all the requests.
The following links work no problem:
http://www.domainname.com:8080/anypath1/anypathxxx
http://www.domainname.com:8080/anypath2/anypathxxx
but the followings to Apache do not work:
http://www.domainname.com/anypath1/anypathxxx
http://www.domainname.com/anypath2/anypathxxx
How do I fix the setting?
Another problem:
How do I setup wildcard proxypass for subdomains so that:
http://zzz.domainname.com/anypath1/anypathxxx proxypass to http://zzz.domainname.com:8080/anypath1/anypathxxx?
Thanks a lot in advance!!
I'am massively using Apache to loadbalance lots of Tomcats. I would strongly recommend mod_jk Apache Tomcat Connector for this case/job -> link. It is really easy to setup and truly stable!
Just install it from a repository, download binary (Windows) or build it from source.
Afterwards follow the quick start tutorial -> link
Also your second question (wildcards) could be solved this way.
I just installed a Rails 3 application on a development server, and it can be loaded by using http://server:3000/
In our production setup, all applications are proxied by apache running on another server. All applications are to be accessed by http://prodserver/appX . CSS and javascripts need to be loaded when using apache proxy.
How do I revise routes.rb and change rails.root to use appX, without changing the application?
Use the ProxyPassReverse configuration command in Apache and it will rewrite URL's so you don't have to change anything in routes.rb