# Restarting apache web server

**URL:** <https://www.ruby-forum.com/t/restarting-apache-web-server/189475>\
**Category:** Rails\
**Created:** [June 1, 2010, 3:26pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475 "2010-06-01T15:26:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![raghu\_muni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@raghu\_muni](https://www.ruby-forum.com/u/raghu_muni)\
**Post date:** [June 1, 2010, 3:26pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475/1 "2010-06-01T15:26:51Z")

</div>

Hi,

I’m following this guide [RubyOnRails - Community Help Wiki](https://help.ubuntu.com/community/RubyOnRails)  
to install ror and configure this with apache…I’m facing a problem when  
restarting the apache2 web server following some steps.

* * *

Now you should point apache to the location of your Ruby app. Create  
something like this in /etc/apache2/sites-available/ror.myhost.com

\<VirtualHost \*\>  
ServerName [ror.myhost.com](http://ror.myhost.com)  
DocumentRoot /home/myuser/www/mynewapp/public  
RailsEnv development #It’s optional string, but my rails app didn’t  
work properly without it.

Alternatively, you could run rails in a specific sub uri of your current  
host, e.g. localhost. First, make a symbolic link to your rails public  
folder from with var/www (or wherever you have the root of your apache  
www folder), e.g.:

ln -s /home/myuser/www/mynewapp/public /var/www/mynewapp

In case of localhost (which is the default host with a fresh  
ubuntu/apache install) edit default in /etc/apache2/sites-available and  
add:

RailsBaseURI /mynewapp

murb: I had to add RailsEnv development as well to get around the ‘no  
route found to match “/rails/info/properties” with {:method=\>:get}’  
warning… (can someone elaborate on why?) apparently this is because  
/info/properties is buggy and no longer supported:  
[http://www.ruby-forum.com/topic/161924](http://www.ruby-forum.com/topic/161924)

Save, and enable the rewrite module for apache, and register this  
site… and finally, restart apache.

sudo a2enmod rewrite  
sudo a2ensite [ror.myhost.com](http://ror.myhost.com)  
sudo /etc/init.d/apache2 restart

* * *

I created a document with [ror.myhost.com](http://ror.myhost.com) and added the code as  
given.Also,I registered the site [ror.myhost.com](http://ror.myhost.com) and restarted the web  
server…However,I get the following error…

sudo /etc/init.d/apache2 restart

- Restarting web server apache2  
Syntax error on line 4 of /etc/apache2/sites-enabled/ror.myhost.com:  
RailsEnv takes one argument, The environment under which a Rails app  
must run.  
[fail]

Can anybody help me with this code…

Thanks,  
Raghu

---

<div class="post-metadata">

**Author:** ![raghu\_muni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@raghu\_muni](https://www.ruby-forum.com/u/raghu_muni)\
**Post date:** [June 1, 2010, 3:43pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475/2 "2010-06-01T15:43:46Z")

</div>

On 1 June 2010 14:26, Raghu M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ServerName [ror.myhost.com](http://ror.myhost.com)  
> ln -s /home/myuser/www/mynewapp/public /var/www/mynewapp  
> /info/properties is buggy and no longer supported:
> 
> I created a document with [ror.myhost.com](http://ror.myhost.com) and added the code as  
> given.Also,I registered the site [ror.myhost.com](http://ror.myhost.com) and restarted the web  
> server…However,I get the following error…
> 
> sudo /etc/init.d/apache2 restart
> 
> - Restarting web server apache2  
> Syntax error on line 4 of /etc/apache2/sites-enabled/ror.myhost.com:  
> RailsEnv takes one argument, The environment under which a Rails app  
> must run.  
> [fail]

Only guessing, but have you tried removing the comment from your  
RailsEnv line? Perhaps it is not interpreting it as a comment and so  
complaining about the number of parameters.

Colin

---

<div class="post-metadata">

**Author:** ![raghu\_muni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@raghu\_muni](https://www.ruby-forum.com/u/raghu_muni)\
**Post date:** [June 1, 2010, 3:50pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475/3 "2010-06-01T15:50:20Z")

</div>

> Only guessing, but have you tried removing the comment from your  
> RailsEnv line? Perhaps it is not interpreting it as a comment and so  
> complaining about the number of parameters.
> 
> Colin

Thnxx colin…it worked

---

<div class="post-metadata">

**Author:** ![raghu\_muni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@raghu\_muni](https://www.ruby-forum.com/u/raghu_muni)\
**Post date:** [June 1, 2010, 4:00pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475/4 "2010-06-01T16:00:41Z")

</div>

How do I make sure(test,if any) that my rails application is configured  
with apache2 webserver I have installed??

---

<div class="post-metadata">

**Author:** ![raghu\_muni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@raghu\_muni](https://www.ruby-forum.com/u/raghu_muni)\
**Post date:** [June 1, 2010, 4:18pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475/5 "2010-06-01T16:18:20Z")

</div>

On 1 June 2010 15:00, Raghu M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How do I make sure(test,if any) that my rails application is configured  
> with apache2 webserver I have installed??

Sorry, don’t understand. What are you trying to be sure of?

Colin

---

<div class="post-metadata">

**Author:** ![raghu\_muni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@raghu\_muni](https://www.ruby-forum.com/u/raghu_muni)\
**Post date:** [June 1, 2010, 4:52pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475/6 "2010-06-01T16:52:19Z")

</div>

On 1 June 2010 15:38, Raghu M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi  
> I’m sorry for miscommunication.  
> I’ve installed rails using the guide I’ve mentioned in the first  
> post…I guess the default configured web server will be webrick…But  
> I’ve configured my rails app to use Apache as a webserver…Now,how do  
> make a test to make sure that my rails application is using apache as my  
> webserver…

Try stopping apache and see if the app stops working.  
sudo /etc/init.d/apache2 stop

---

<div class="post-metadata">

**Author:** ![raghu\_muni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/85f322/32.png) [@raghu\_muni](https://www.ruby-forum.com/u/raghu_muni)\
**Post date:** [June 1, 2010, 4:38pm UTC](https://www.ruby-forum.com/t/restarting-apache-web-server/189475/7 "2010-06-01T16:38:03Z")

</div>

Hi  
I’m sorry for miscommunication.  
I’ve installed rails using the guide I’ve mentioned in the first  
post…I guess the default configured web server will be webrick…But  
I’ve configured my rails app to use Apache as a webserver…Now,how do  
make a test to make sure that my rails application is using apache as my  
webserver…

I tried to make something…when I run my demo application using ruby  
script/server…it returns something like this…

# ruby script/server

=\> Booting Mongrel  
=\> Rails 2.3.8 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
=\> Call with -d to detach  
=\> Ctrl-C to shutdown server  
Do that mean that I’ve configured my application with Apache+mongrel??

Thanks
