# Deployment Routing Issue

**URL:** <https://www.ruby-forum.com/t/deployment-routing-issue/110126>\
**Category:** Rails\
**Created:** [July 23, 2007, 4:23pm UTC](https://www.ruby-forum.com/t/deployment-routing-issue/110126 "2007-07-23T16:23:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pete\_Bekisz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8edcca/32.png) [@Pete\_Bekisz](https://www.ruby-forum.com/u/Pete_Bekisz)\
**Post date:** [July 23, 2007, 4:23pm UTC](https://www.ruby-forum.com/t/deployment-routing-issue/110126/1 "2007-07-23T16:23:18Z")

</div>

Hi folks,

I used Cap to deploy my first Rails app on Friday, but every time I  
try getting to the pages, I’m getting a 404 error. In my  
production.log, I keep getting an error message similar to this: “no  
route found to match “/.html” with {:method=\>:get}” It’s doing this  
for everything.

Everything works fine on my development machine.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![Pete\_Bekisz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8edcca/32.png) [@Pete\_Bekisz](https://www.ruby-forum.com/u/Pete_Bekisz)\
**Post date:** [July 23, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/deployment-routing-issue/110126/2 "2007-07-23T16:30:44Z")

</div>

On 23-Jul-07, at 10:22 AM, Pete Bekisz wrote:

> Any suggestions?

We’ll need some more info Pete.

Like web server, app server. Did you use Deprec (or some other tool)  
to setup your box? mongrel? fastcgi?

- sounds a bit like you have an apache url rewrite problem.

give some more symptoms.

thanx.  
Jodi

---

<div class="post-metadata">

**Author:** ![Pete\_Bekisz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8edcca/32.png) [@Pete\_Bekisz](https://www.ruby-forum.com/u/Pete_Bekisz)\
**Post date:** [July 23, 2007, 4:36pm UTC](https://www.ruby-forum.com/t/deployment-routing-issue/110126/3 "2007-07-23T16:36:03Z")

</div>

Sorry about that …

Web server is Apache 2.0.2 – can’t upgrade to 2.2 just yet. App is  
being served by Mongrel.

Here’s what I have in the Apache configuration:

```
          # Set the domain
          #ServerName apply.keuka.edu:80
          #ServerAlias www.apply.keuka.edu

          # Set the DocumentRoot, this is where apache will look

```

for static files

```
          # This is the public directory of your rails application

          # As previously stated, my app is deployed with

```

Capistrano, so I set DocumentRoot to the current/public directory

```
          DocumentRoot 

```

/var/www/vhosts/apply.keuka.edu/rails/current/public

```
          # Set where you want apache put its logs

          # note I use deflate as log format, this is because I

```

use mod\_deflate to compress all outputs

```
          CustomLog

```

/var/www/vhosts/apply.keuka.edu/rails/current/access.log combined

```
          ErrorLog 

```

/var/www/vhosts/apply.keuka.edu/rails/current/error.log

```
          # if you want to have server-wide statistics,

          # you can also tell apache to log in a common file

```

shared by all your domains

```
          # CustomLog /var/log/apache2/access.log deflate

          # ErrorLog /var/log/apache2/error.log

          # I use utf-8 for all my projects, so I force apache to

```

send the good charset by default.

```
          # This is needed if you use page caching and want apache

```

serves these with the good charset.

```
          # AddDefaultCharset utf-8

          # Allow limited access to your public directory

          # dont allow user to list directories

          # allow apache to FollowSymlinks

          <Directory 

```

/var/www/vhosts/apply.keuka.edu/rails/current/public\>

```
            Options -Indexes FollowSymLinks

            AllowOverride All

            Order allow,deny

            Allow from all

          </Directory>

          # Be sure mod_rewrite is activated for you vhost

          RewriteEngine On

          # If you use applications which resides in cgi-bin, like 

```

awstats

```
          # the following mod_rewrite RewriteRule will allow

```

apache to know it should not proxy these request and the PT switch  
will allow the ScriptAlias directive to work

```
          # RewriteRule "^/cgi-bin/.*" "$0" [QSA,PT,L]

          # RewriteRule "^/awstatsicon/.*" "$0" [PT,L]

          # Set a ScriptAlias for /cgi-bin/ url

          # All url begining with /cgi-bin/ will be served from

```

the specified cgi-bin deirectory

```
          #ScriptAlias /cgi-bin/ /var/www/mydomain.tld/cgi-bin/

          #<Directory /var/www/mydomain.tld/cgi-bin/>

          # AllowOverride All

          # Options ExecCGI FollowSymLinks

          # Order allow,deny

          # Allow from all

          #</Directory>

         # Do not allow open proxying, allow only requests starting 

```

with a /

```
         <LocationMatch "^[^/]">

            Deny from all

         </LocationMatch>

         # Avoid open you server to proxying

         ProxyRequests Off

         # Let apache correctly rewrite redirect

         ProxyPassReverse / http://localhost:8000/

         # Let apache pass the original host not the ProxyPass one

         ProxyPreserveHost On

         # As I mentioned earlier, Capistrano disable_web task

```

allows you to disable your application

```
         # In fact it only create a simple page named

```

maintenance.html in the directory public/system/ of your application

```
         # The following mod_rewrite rules will tell apache to

```

directly serve the maintenance.html pages if it find it out.

```
         RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f

         RewriteCond %{SCRIPT_FILENAME} !maintenance.html

         RewriteRule ^.*$ /system/maintenance.html [L]

         # For static files it's good to avoid hitting your mongrel 

```

process

```
         # so let apache knows it should serve it directly

         # for a rails application it means, files in images /

```

stylesheets / javascripts

```
         RewriteRule "^/(images|stylesheets|javascripts)/?(.*)" "$0" 

```

[L]

```
         # Try to match a cached pages

         RewriteRule ^([^.]+)$ $1.html [QSA]

         # if the cached page does not exists

         RewriteCond %{REQUEST_FILENAME} !-f

         # proxy requests to your mongrel instance

         RewriteRule "^/(.*)" "http://localhost:8001/$1" [P,QSA,L]
```

---

<div class="post-metadata">

**Author:** ![Pete\_Bekisz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/8edcca/32.png) [@Pete\_Bekisz](https://www.ruby-forum.com/u/Pete_Bekisz)\
**Post date:** [July 23, 2007, 4:50pm UTC](https://www.ruby-forum.com/t/deployment-routing-issue/110126/4 "2007-07-23T16:50:54Z")

</div>

On 23-Jul-07, at 10:35 AM, Pete Bekisz wrote:

> Sorry about that …
> 
> Web server is Apache 2.0.2 – can’t upgrade to 2.2 just yet. App is  
> being served by Mongrel.
> 
> Here’s what I have in the Apache configuration:

Hey Pete - my apache-fu (especially rewrites) is weak, but from a  
scan it looks like you’ve deployed mongrel to 2 ports (8000, 8001).  
Is this intentional?

ProxyPassReverse / [http://localhost:8000/](http://localhost:8000/)

then a rewrite rule for:

RewriteRule “^/(.\*)” “[http://localhost:8001/$1](http://localhost:8001/$1)” [P,QSA,L]

that looks a little fishy.

If that’s not it, then I would kill your rewrite rules wholesale,  
verify it’s working, then add them back slowly.

I’d give you my apache2 config, but I bet it’s too different to be  
useful.

cheers,  
Jodi
