Apache Tomcat and Ruby - ruby-on-rails

We have Ruby Rails and Apache tomcat servers running on the samw windows server. When the App on Apache Tomcat is installed alone its working fine, but when the ruby app is installed, the Apace Tomcat App stops working. We need to have both the apps running on the same server. Please help. The application running on Tomcat is displaying the login screens and allowing the users the login. And then rest of the things are failing. The application running on Ruby is just fine as expected. Also, we installed Apace Tomcat and then Ruby on to this server. so there are a lot of chances that the Ruby took Tomcat's port. But how to figure out the overlap?

You probably have both trying to bind to port 80. Whatever server you're using for rails (passenger via nginx/apache http server, nginx+thin/mongrel, etc) is bound to port 80, then tomcat tries to do the same and can't.
If you're using nginx, I would configure tomcat to run on 8080 and reverse proxy http requests to tomcat based on the hostname of part of the url.
You can do this too with apache http server with mod_proxy.

Related

What is localhost:8000 as used in Codecademy (for AngularJS and Ruby on Rails tutorials)?

I want to know what is this: localhost:8000, found in Codecademy tutorials for AngularJS and Ruby on Rails. I even installed Apache 2, but to work with it I need to dial: http://localhost/. While working on some html files, I often come across Firefox's Inspect Element where a section is to mention localhost and its number like this: localhost:8000. I want to know what's this and can I use it to access my host from my android device or some other PC as we do access Codecademy's localhost to learn AngularJS and Ruby on Rails. Pls help. Thanks in advance. :-)
Localhost is the loopback-address of your pc. The IP-address behind it is 127.0.0.1. With localhost, it is possible to simulate a web-server environment and it is mostly used to simulate running web-applications as if they are running on a webserver. :8000 stands for the port-number on which the browser connects to the server. This is because the application runs (in this case) on port 8000 of the server. So it is not enough to just install Apache 2 and surf to http://localhost/ you have to configure Apache so that it runs your web-application on the desired port. The port-number itself has no special meaning. The different ports are just a part of the url so the browser knows on which port it has to connect. Some protocols use default ports. (e.g. HTTP will always connect to port 80, unless your specify another port in your webbrowser)
I'm sure a lot of people can explain it much better, but here is a begin.
More info about running ruby on rails on an Apache webserver:
How can i run a ruby on rails project on apache server?
How to setup Ruby on Rails Hosting using Apache, from Development to Production
EDIT: Technically, the whole 127.0.0.0/8 address block is reserved for loopback purposes. The default one, configurged in hosts.txt is 127.0.0.1 and the most famous.

Nginx and Apache working together

I'm trying to have different applications on the same server. The main app is written in Ruby on Rails 4 alongside 2 PHP systems. Up until now I have had a simple Apache with a virtual host listening on port 80 and my PHP apps deployed under /var/www/.
Now I installed Nginx and when I set it up and I point to /var/www/rails-apps/ I don't know how to get the others application (/www/var/wiki and /www/var/chat) working. I've tried with changing ports for Apache but nothing worked for me.
Could you guide me about how to front a solution here?

Deployed Rails3 but not showing up outside of server

I just deployed my Rails3 app to a linux server with Capistrano and Unicorn using mysql2. I keep getting the error "Oops! Google Chrome could not connect to 172.16.128.125" when trying to access the app in a browser.
What is weird is that I see no errors in the ./log/production.log file and if I use lynx on the server, I can render all pages of the app.
What am I missing? It works locally on the server but not outside the server.
Sounds like you might not have Apache running, or port 80 may not be reachable on that machine due to firewalling or routing issues.

Deploying Java war and Rails app to Apache in Amazon EC2

is it possible to deploy java app and rails app to same EC2 sever. I have a rails app that communicates a java app via AJAX so I need to deploy both to same server. Is there any way to do that or any resource to see how to?
I guess it is possible by using apache2 with tomcat and passenger. Is it true?
You can install two servers in diferent ports i.e. Apache HTTP on 80 and Apache Tomcat (or other) on 8080. Also you can use mod_jk if you want attend all your clients through Apache HTTP. MOD_JK enables to you to integrate Apache Tomcat and Apache HTTP.

Deploying Apache Solr

I've been experimenting with Apache SOLR and I'm ready to integrate it with a rails application. However, I'd like to make sure I know how to deploy solr. I currently have the rails application deployed using passenger+nginx. Is it possible to deploy SOLR using nginx as well? If so, how would I do that? Otherwise, what is the preferred method of deployment? Thanks!
Solr needs to run in a Java EE application server. You can use Jetty or Tomcat. Nginx will act as a proxy via AJP or something simliar to forward all RESTless request to Solr. I haven't used my ajp with nginx but I have read about this. Essentially you will have a Java EE application server, Rails server, nginx, passenger and ajp proxy running all at the same time.
You can also setup a proxy pass and there is a tutorial here. Explore different options to see which one is bet for you.

Resources