I'm totally lost trying to deploy a demo Rails app to my-app-name.appspot.com. I set up a project in the Developers Console and deployed the Ruby stack on my VM. I would have thought I just need to configure the web server's default site such that the DocumentRoot is the public folder of my Rails app (from /etc/apache2/sites-available/default):
<VirtualHost *:80>
ServerName my-app-name.appspot.com
DocumentRoot /apps/my-app-name/public
<Directory /apps/my-app-name/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
Since I'm aiming for the my-app-name.appspot.com space and not using a separate domain, I'm guessing the ServerName and ServerAlias settings are not needed in this case. Now when I visit my target appspot.com address I get a 404 error:
Not Found - The requested URL / was not found on this server.
The logs show that Phusion Passenger is in fact listening to requests. And when I visit the numbered IP address for my project I still get Apache's default index page. Obviously there's a crucial part of the picture I'm not seeing, so any help is greatly appreciated.
Thanks to the posters who commented, I now understand that I was barking up the wrong tree. The appspot.com domain is not compatible with compute engine; I will have to access my project via the IP address.
Also, since I was only trying to put up a test app as proof of concept, I needed to set the Rails environment to development. I was frustrated until I found these instructions (Step 6): https://www.digitalocean.com/community/tutorials/how-to-deploy-a-rails-app-with-passenger-and-apache-on-ubuntu-14-04
Detailed instructions how to deploy Ruby on Rails on Google Compute Engine:
http://startup-with-gae.blogspot.com/2015/08/how-to-deploy-ruby-on-rails-application.html
Related
I am trying to deploy my Ruby on Rails application using Phusion Passenger and the Apache2 module on MacOS. I believe I have installed all dependencies and gems correctly and think a problem lies in my configuration files. I do not have a domain so I am trying to use localhost to deploy.
this first file is the configuration for the apache2 web server and is located in /private/etc/apache2/httpd.conf I think my issue is with the ServerName. I do not have a domain to publicly host this web application from yet. I am trying to locally deploy it first. I have been using localhost:3000 for my development and want to deploy it using that as well. Maybe I am not understanding something vital here with deploying and ServerName.
httpd.conf
<VirtualHost *:80>
ServerName localhost.depot
DocumentRoot /Users/rubythree/Documents/agile-web-development-with-rails-5.1/production/depot/public
SetEnv SECRET_KEY_BASE "secret_key_here"
<Directory /Users/rubythree/Documents/agile-web-development-with-rails-5.1/production/depot/public>
AllowOverride all
Options -MultiViews
Require all granted
</Directory>
</VirtualHost>
the next file where an issue might be is the hosts file located in /private/etc/hosts where I added the following line...
hosts
127.1.1.1 localhost.depot
I am new to Phusion Passenger and Apache and am pretty sure I am missing something in my configuration files here. When i try to access the ip 127.1.1.1 after a while of loading the browser will not be able to reach the server. running curl 127.1.1.1 will not return anything either, it will timeout. Any help or direction is appreciated :)
Even if ServerName does not match - apache will serve the first virtualhost as default.
"This machine" address is 127.0.0.1, also make sure apache is actually running and has no errors in logs
This is driving me nuts. Hopefully someone can help
I've deployed a Rails app on an EC2 instance (Ubuntu) using Apache and Passenger. Here's my Apache configuration on the EC2 instance
/etc/apache2/apache2.conf
<VirtualHost *:80>
ServerName ec2-52-16-160-160.eu-west-1.compute.amazonaws.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /home/ubuntu/workspace/intellitute/public
ErrorLog /home/ubuntu/workspace/intellitute/log/error.log
RailsEnv development
<Directory /home/ubuntu/workspace/intellitute/public>
# This relaxes Apache security settings.
AllowOverride all
Require all granted
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
This works and I'm able to access the application by putting ec2-52-16-160-160.eu-west-1.compute.amazonaws.com into a browser.
I've registered a domain name with a provider (not AWS) and set up two 'A' DNS records there (appname.com & *.appname.com) to point at the public ip of my server - 52.16.160.160.
I've then changed the ServerName in the conf file above to the domain name I registered and restarted the Apache server.
<VirtualHost *:80>
ServerName www.appname.com (also tried 'ServerName appname.com')
.....
But when I type www.appname.com into a browser I'm just getting the Apache2 Ubuntu Default Page. I'm assuming the fact I'm getting the default page means the DNS is working but for some reason Passenger is not loading the application? Is this assumption correct?
Does it make a difference that I'm still working in the development environment?
I'm stuck and can't find any solution.
Thanks for looking
Edit 1
I'm not at my development machine at the moment but does it make a difference that I haven't set up an elastic IP address on my EC2 instance? I'm just using the public IP address provided by the instance. I'll try set one up later to see what happens.
Finally figured this out. Might help someone in the future.
My EC2 instance was a clone of another and I reckon there was some issues with the apache2 and passenger configurations. I uninstalled and re-installed them on the EC2 instance and it is now working (for appname.com, not www.appname.com - I'll have to figure that out)
Same question asked multiple times but no feasible answer is available yet and also the available answers just support hard coded subdomains:
I applied dynamic subdomain in my rails 3.2.13 app and its working locally by using lvh.me instead of localhost as specified by rails cast.
My urls are like
local
subdomain.app_name.lvh.me:3000/
In porduction:
subdomain.app_name.abc.com/
My site is on appache + passenger
and it seems that appache not forwarding request to passenger.
Am I missing something?
I followed this
http://railscasts.com/episodes/221-subdomains-in-rails-3
Note:
I don't need hardcoded subdomains as they will be generated dynamically and at extensive level.
1) Point *.abc.com in your DNS setup to your server.
2) Setup an Apache vhost to catch the star pointer:
<VirtualHost *:80>
ServerName abc.com
ServerAlias *.abc.com
DocumentRoot /home/public_html/yourapplication/current/public
</VirtualHost>
I've searched the web, but I can only find information on sharing code between multiple sites and on separating the database to isolated models. This is not what I want.
I want to run a single rails server, with a single DNS address and a single port - http://myportal.com - that will handle several other sites - http://myportal.com/site1, http://myportal.com/site2 etc.
I want each site to have it's own folder(and SCM repository), it's own database, it's own routing - it's own everything. That is - I want to be able to develop each site as a standalone - that means I need to be able to run site1 site as http://localhost:3000 and not http://localhost:3000/site1.
On the server, the root site(the one that responds to the http://myportal.com address should be the one I run the server from, and it should know the absolute paths of the other sites(which will be in different directories on the server, not in child directories of the root site) and provide routing information for them - but it should also chain to the other sites routes.rb files. That means that if I go to address http://myportal.com/site1/books/ the root site should handle http://myportal.com/site1, and site1 should handle /books/. The root site should not need to know about the other sites' internal routing structures.
Is this possible? Right now I'm running the rails server that comes with the gem(rails server from the command line) on a Windows Server 2008 server, but I'm willing to install another server if that's what needed to accomplish the goal I described.
Thanks in advance!
You should be able to do this with Apache or nginx and possibly IIS if configured correctly. I'm most familiar with Apache and the flexible mod_rewrite and mod_proxy components that can facilitate this.
The idea is you rewrite http://example.com/ to be http://example.com:3000/ and http://example.com/site2 as http://example.com:3001/site2 and so forth.
It's also possible to do this with Passenger and some clever use of the VirtualHost directive, but you may have to fiddle to get a configuration that works for you. Remember that rewriting the headers to route internally has no effect on the resulting HTML your servers emit.
Create a symlink:
cd ~/Sites
ln -s /Users/hg/Developer/Rails/railsproj1/public ./railsproj1
modify apache config file
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Users/hg/Sites
<Directory /Users/hg/Sites>
AllowOverride All
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
</Directory>
RailsBaseURI /railsproj1
RailsEnv development
</VirtualHost>
Answer source: http://collab.stat.ucla.edu/users/jose/weblog/9e335/
I am using Ruby on Rails 3.1 and I have an application running at the www.mywebsitename.com domain. For improvement reasons I would like to run my application at the www.uk.mywebsitename.com subdomain (BTW: at the www.mywebsitename.com domain I will run a RoR application to redirect users to the proper subdomain).
I do not need geocoding or similar. Simply, I would like to know how to run my application on the www.uk.mywebsitename.com Web address (I am planning to add as subdomain other/similar RoR applications like www.de.mywebsitename.com and www.it.mywebsitename.com, each working with a separate database): what I have to care/do? what do you advice about?
P.S.: My server is running Linux Ubuntu and Apache. I deploy with the Capistrano gem.
It seems like you're looking for how to make apache vhosts, since that's basically what they do.
I assume you're using phusion passenger, and in that case you should already have one vhost (or at least a default site in /etc/apache/sites-available (or something similar, it might be apache2, I'm not entirely sure).
What you basically need to do to get multiple rails applications working is to set up one vhost for each rails application and set the proper ServerName and DocumentRoot for each vhost.
It might look something like this for you uk site:
<VirtualHost *:80>
ServerName www.uk.mywebsitename.com
DocumentRoot /path/to/where/your/uk/site/is/deployed/current/public
<Directory /path/to/where/your/uk/site/is/deployed/current/public>
Allow from all
Options -MultiViews
</Directory>
</VirtualHost>
How to setup vhosts for passenger is documented in the passenger documentation.