mediagoblin-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [GMG-Devel] Fixed the apache config example in the wiki


From: Christopher Allan Webber
Subject: Re: [GMG-Devel] Fixed the apache config example in the wiki
Date: Tue, 11 Dec 2012 22:17:45 -0600
User-agent: mu4e 0.9.9-dev6; emacs 24.0.92.1

Apparently by "I fixed things" I should have said "actually I completely
and totally broke them."

But the example on the wiki for fcgid does not work, it appears.  At the
very least, I tested on a friend's server with the following:

  /mgoblin_media/media_entries/nonexistant/

I get:

  The resource could not be found.
  The resource at http://DOMAIN.org/mgoblin_media/media_entries/nonexistant/ 
could not be found
  WSGI Server

This suggests it's being routed through paste/python, which it shouldn't
have to do... it should go through apache!

However, admittedly I tend to get really confused by apache config options.

It does look like everything is being forced through mg.fcgi though.  I'm
not really sure what the right solution is. :\

Basically this:
  RewriteEngine On
  RewriteRule ^(mgoblin_static|mgoblin_media)($|/) - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ /mg.fcgi/$1 [QSA,L]

*should* be more like:

  RewriteCond %{REQUEST_URI} !^/(mgoblin_static|mgoblin_media)/
  RewriteRule ^/(.*)$ /mg.fcgi/$1 [QSA,L]

... I think.  However, that doesn't work either, for entirely different
reasons: it seems like the aliases to /mgoblin_static/ and
/mgoblin_media/ are not working.

Additionally, the wiki says:

  <Directory /mgoblin_static>
    Order allow,deny
    Allow from all
  </Directory>

  <Directory /mgoblin_media>
    Order allow,deny
    Allow from all
  </Directory>

Shouldn't that be Location, not Directory?

Does someone with better apache/fcgid chops have any idea how to resolve
this? :)

Additionally, I came up with an alternative recipe:

<VirtualHost *:80>
  Options +ExecCGI

  ServerName mediagoblin.example.org
  
  Alias /mgoblin_static/ /srv/mediagoblin/mediagoblin/static/
  Alias /mgoblin_media/ /srv/mediagoblin/user_dev/media/public/
  
  Alias /mgoblin.fcgi /srv/mediagoblin/mg.fcgi
  
  # Rewrite all URLs to fcgi, except for static and media urls                  
                 
  RewriteEngine On
  RewriteCond %{REQUEST_URI} !^/(mgoblin_static|mgoblin_media)/
  RewriteRule ^/(.*)$ /mgoblin.fcgi/$1 [PT,L]
  
  FcgidMaxRequestLen 16777216
  
</VirtualHost>

This works, but the problem with this though is that it ends up
generating urls like:

  /mgoblin.fcgi/u/cwebber/

instead of:

  /u/cwebber/

I think this is related to our supporting of mounting mediagoblin at
subdirectories.  It might also have something to do with SCRIPT_NAME,
which is something that always confuses me on how to do right.

Thoughts?????
 - Chris

Christopher Allan Webber writes:

> Yo,
>
> If you're currently deploying via the apache config example in the wiki,
> *plese* see the updated example on the wiki.
>
> I've updated the rewrite rules to be like:
>
>   # Rewrite all URLs to fcgi, except for static and media urls
>   RewriteEngine On
>   RewriteRule ^/(mgoblin_static|mgoblin_media)/ - [L]
>   RewriteCond %{REQUEST_FILENAME} !-f
>   RewriteRule ^/(.*)$ /mg.fcgi/$1 [QSA,L]
>
> The first RewriteRule used to be different, and I discovered that on my
> friend's server that it was not actually serving the media directly via
> apache at all.. it was passing it through python first!  Which is WAY
> LESS EFFICIENT than is reasonable!
>
> So, update your configs! :)
>  - Chris
>
> _______________________________________________
> devel mailing list
> address@hidden
> http://lists.mediagoblin.org/listinfo/devel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]