I''d like to get some help with setting up a virtual host on my Ubuntu breezy installation. I''m trying to get the rails app "tracks" working so that https://myip/tracks is valid. I made the file :/etc/apache2/sites-available/tracks" and enabled it with "sudo a2ensite tracks" and restarted apache2. The file contains: <VirtualHost *:443> ServerName rails DocumentRoot /usr/local/share/tracks/public/ ErrorLog /usr/local/share/tracks/log/server.log <Directory /usr/local/share/tracks/public/> Options ExecCGI FollowSymLinks AllowOverride all Allow from all Order allow,deny </Directory> </VirtualHost> But trying to go to the URL "https://localhost/tracks", I get: Not Found The requested URL /tracks was not found on this server. ------------------------------------------------------------------------ Apache/2.0.54 (Ubuntu) mod_fastcgi/2.4.2 PHP/4.4.0-3 mod_ruby/1.2.4 Ruby/1.8.3(2005-06-23) mod_ssl/2.0.54 OpenSSL/0.9.7g mod_perl/2.0.1 Perl/v5.8.7 Server at localhost Port 443 Any help most appreciated! Stephen
On 20 Oct 2005, at 1:43 pm, Stephen Boulet wrote:> I''d like to get some help with setting up a virtual host on my Ubuntu > breezy installation. > > I''m trying to get the rails app "tracks" working so that > https://myip/tracks is valid.This is your problem. Virtual hosting is for creating two completely separate sites that live on the same Apache server. For instance, you could set it up so that http://mymachine/ serves up your usual site, and http://tracks/ serves up your Rails app. Even though they''re both pointing to the same IP address, Apache behaves like two separate web servers. However, since all you want to do is access your Rails app at http:// myip/tracks, then you don''t need a virtual host. All you''re doing is serving up something (in this case, the URL /tracks/) from your normal website (in this case, http://myip/). So you just need a symbolic link in your normal web directory that points to your Rails app''s public directory. I don''t know where Ubuntu puts its website root directory by default. But, for example, on my Gentoo system it''s in /var/www/localhost/ htdocs. So I''d do ln -s /usr/local/share/tracks/public /var/www/localhost/htdocs/tracks Hope that helps! Chris
On Thu, 20 Oct 2005 20:32:35 +0100, Chris Mear wrote> On 20 Oct 2005, at 1:43 pm, Stephen Boulet wrote: > > > I''d like to get some help with setting up a virtual host on my Ubuntu > > breezy installation. > > > > I''m trying to get the rails app "tracks" working so that > > https://myip/tracks is valid. > > This is your problem. Virtual hosting is for creating two completely > separate sites that live on the same Apache server. For instance, > you could set it up so that http://mymachine/ serves up your usual > site, and http://tracks/ serves up your Rails app. Even though > they''re both pointing to the same IP address, Apache behaves like > two separate web servers. > > However, since all you want to do is access your Rails app at > http:// myip/tracks, then you don''t need a virtual host. All you''re > doing is serving up something (in this case, the URL /tracks/) from > your normal website (in this case, http://myip/). So you just need > a symbolic link in your normal web directory that points to your > Rails app''s public directory. > > I don''t know where Ubuntu puts its website root directory by > default. But, for example, on my Gentoo system it''s in > /var/www/localhost/ htdocs. So I''d do > > ln -s /usr/local/share/tracks/public /var/www/localhost/htdocs/tracks > > Hope that helps! > > ChrisThanks Chris. I''ll try the symbolic link route. This is probably a very stupid question, but if I am using rails this way, there is no need to start a server with the "ruby script/server" command, right? _________ Stephen If your desktop gets out of control easily, you probably have too much stuff on it that doesn''t need to be there. Donna Smallin, "Unclutter Your Home"
Nicholas Van Weerdenburg
2005-Oct-20 20:52 UTC
Re: Help with virtual hosting of a rails app
On 10/20/05, Stephen Boulet <stephen-Jycz+9znHa/0ZspJkgaKTw@public.gmane.org> wrote:> On Thu, 20 Oct 2005 20:32:35 +0100, Chris Mear wrote > > On 20 Oct 2005, at 1:43 pm, Stephen Boulet wrote: > > > > > I''d like to get some help with setting up a virtual host on my Ubuntu > > > breezy installation. > > > > > > I''m trying to get the rails app "tracks" working so that > > > https://myip/tracks is valid. > > > > This is your problem. Virtual hosting is for creating two completely > > separate sites that live on the same Apache server. For instance, > > you could set it up so that http://mymachine/ serves up your usual > > site, and http://tracks/ serves up your Rails app. Even though > > they''re both pointing to the same IP address, Apache behaves like > > two separate web servers. > > > > However, since all you want to do is access your Rails app at > > http:// myip/tracks, then you don''t need a virtual host. All you''re > > doing is serving up something (in this case, the URL /tracks/) from > > your normal website (in this case, http://myip/). So you just need > > a symbolic link in your normal web directory that points to your > > Rails app''s public directory. > > > > I don''t know where Ubuntu puts its website root directory by > > default. But, for example, on my Gentoo system it''s in > > /var/www/localhost/ htdocs. So I''d do > > > > ln -s /usr/local/share/tracks/public /var/www/localhost/htdocs/tracks > > > > Hope that helps! > > > > Chris > > Thanks Chris. I''ll try the symbolic link route. > > This is probably a very stupid question, but if I am using rails this way, > there is no need to start a server with the "ruby script/server" command, right? > > _________ > Stephen > > If your desktop gets out of control easily, > you probably have too much stuff on it that > doesn''t need to be there. > Donna Smallin, "Unclutter Your Home" > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >Right. That is for launched webrick, Ruby''s internal web-server. Look at the .htaccess file in the public directory. That''s the Apache magic that launches rails. In particular, the dispatch.cgi or dispatch.fcgi call. .htaccess is a an apache file that apache looks for in directories and automatically processes for per directory configuration. Thus, you can configure a lot of your app from within the rails public directory by changing .htaccess, and not have to go into the regular apache conf files (.e.g httpd.conf). Nick -- Nicholas Van Weerdenburg
On Thu, 2005-10-20 at 07:43 -0500, Stephen Boulet wrote:> I''d like to get some help with setting up a virtual host on my Ubuntu > breezy installation. > > I''m trying to get the rails app "tracks" working so that > https://myip/tracks is valid. > > I made the file :/etc/apache2/sites-available/tracks" and enabled it > with "sudo a2ensite tracks" and restarted apache2. > > The file contains: > > <VirtualHost *:443> > ServerName railsStephen, I''m assuming this is for local use, yes? Without Bind or any other kind of DNS? If that''s the case, here''s what I''d do: - In /etc/hosts add a line like (assuming you have your server on 192.168.1.1): 192.168.1.1 myip - Change the above line from: ServerName rails to: ServerName myip that will make the site available to https://myip NOTE: 443 is the default SSL port, so I am _assuming_ this will do the trick to engage https://, as Apache seems to be reporting mod_ssl and OpenSSL are already configured -- somebody check me on that if I''m wrong :)>From there, you could either create at tracks controller or use routesto achieve the https://myip/tracks HTH, Howard P.S. Don''t forget to edit public/.htaccess for FCGI :)