25 Apr 2013, 09:18
Generic-user-small

Louis Rhys (22 posts)

I followed Passenger’s and the book’s instruction and appended the following code to my apache config.

# Passenger
LoadModule passenger_module /home/louisr/.rvm/gems/ruby-1.9.2-p320/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /home/louisr/.rvm/gems/ruby-1.9.2-p320/gems/passenger-3.0.19
PassengerRuby /home/louisr/.rvm/wrappers/ruby-1.9.2-p320/ruby

 <VirtualHost *:80>
      ServerName www.louisr.com 
     # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /home/louisr/codes/depot/public    
      <Directory /home/louisr/codes/depot/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
	 Order allow,deny
	 Allow from all
      </Directory>
   </VirtualHost>

When I restart apache, I got @apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName@

Ok, maybe I misconfigured something. But when I open 127.0.1.1 in my browser, I onlye got :

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

Any idea what I did wrong?

25 Apr 2013, 12:32
Generic-user-small

Dawid Stępień (3 posts)

Hi Louis,

In my configuration I have a separate file with directives for rails applications. The file must be placed in @@sites-enabled/@ directory. Directive may looks like this:

<VirtualHost *:80>
   ServerName depot.exampledomain.com
   DocumentRoot /home/dawid/htdocs/depot/public
   <Directory /home/dawid/htdocs/depot/public>
      AllowOverride all
      Options -MultiViews
   </Directory>
</VirtualHost>

You must remember that your domain must be properly configured. For example you can edit @/etc/hosts@ file (if you work with linux os) and append something like this:

127.0.0.1 depot.exampledomain.com

If you want to work with localhost you can try to move all configuration from @sites-enabled/@ except the rails one.

Regards, Dawid

25 Apr 2013, 12:31
Generic-user-small

Louis Rhys (22 posts)

what do you call this file?

25 Apr 2013, 12:38
Generic-user-small

Dawid Stępień (3 posts)

Any file. You can name it @rails@ for example.

25 Apr 2013, 14:34
Generic-user-small

Louis Rhys (22 posts)

Thanks for the help. Now it is saying: We’re sorry, but something went wrong.

Any idea what’s wrong? Or where to find the related log? I tried the logs in /var/log/apache2/ didn’t seem to have any meaningful message

25 Apr 2013, 14:50
Samr_small_pragsmall

Sam Ruby (584 posts)

/var/log/apache2/error.log is indeed the right place to look.

Assuming you are on a Ubuntu like system, the following command can address the server name warning:

echo Servername hostname sudo cat > /etc/apache2/conf.d/servername
25 Apr 2013, 15:51
Generic-user-small

Louis Rhys (22 posts)

I am on Ubuntu. Thanks, adding my host name to /etc/apache2/conf.d/servername fixes the servername warning. However, I still have the error when opening the application:

We’re sorry, but something went wrong.

The only lines I got in error.log is

[Thu Apr 25 22:52:57 2013] [notice] SIGHUP received. Attempting to restart [Thu Apr 25 22:52:57 2013] [notice] Apache/2.2.22 (Ubuntu) Phusion_Passenger/3.0.19 configured -- resuming normal operations</pre>

25 Apr 2013, 16:08
Generic-user-small

Louis Rhys (22 posts)

Oops, I took a look at production.log and found

Started GET “/” for 127.0.0.1 at 2013-04-25 22:53:28 Processing by StoreController#index as HTML Completed 500 Internal Server Error in 1ms

ActiveRecord::StatementInvalid (Could not find table ‘carts’): app/controllers/application_controller.rb:10:in rescue in current_cart' app/controllers/application_controller.rb:8:in current_cart’ app/controllers/store_controller.rb:5:in `index’

.. and I found the next text in the book the next section was about setting up production DB. Looks like I didn’t realize that I had to finish the section before trying the application. Sorry about that!

  You must be logged in to comment