[erlang-questions] Static files served through Webmachine

Tristan Sloughter tristan.sloughter@REDACTED
Fri Jul 22 15:50:57 CEST 2011


So like:

root /var/www/

Didn't seem to work. I need to find where OSX stores the damn nginx logs...
That will probably explain whats going on.

On Fri, Jul 22, 2011 at 5:15 AM, Sam Elliott <sam@REDACTED> wrote:

> Add a trailing slash to your root delcaration. It's currently looking for
> '/var/www/files/test.html' - with the trailing slash it will look for
> '/var/www/test.html' (Yes, this seems like odd behaviour, but that's what
> they say to do on the page about it)
>
> Sam
> --
> Sam Elliott
> sam@REDACTED
> --
>
>
>
> On Fri, Jul 22, 2011 at 2:17 AM, Tristan Sloughter <
> tristan.sloughter@REDACTED> wrote:
>
>> So I'm messing around with using nginx's xsendfile. I have the proxy setup
>> and its working fine. And I have the following in the config to serve the
>> static files:
>>
>> location /files {
>>     root /var/www;
>>     internal;
>> }
>>
>> The proxying works fine and when I make a request to the nginx server it
>> properly ends up going to the Webmachine server, which dispatch rule sends
>> it to my resource for static files. Here I return:
>>
>> NewReqData = wrq:set_resp_header("X-Accel-Redirect", "/files/test.html",
>> ReqData),
>> {"", NewReqData, Ctx}.
>>
>> But this does not work to end up having nginx serve up test.html from
>> /var/www. Should it? Am I doing it completely wrong? Any suggestions?
>>
>> Thanks,
>> Tristan
>>
>> On Wed, Jul 20, 2011 at 6:51 PM, Kenny Stone <kennethstone@REDACTED>wrote:
>>
>>> One way to look at it is that Erlang has (more powerful) versions of
>>> redis/memcached built in with ETS and Mnesia.  These are pretty nice
>>> features for web development, and I'm always a fan of cutting down the
>>> external dependencies for deployment and dev.  Just rebar your repo and you
>>> get this powerful, self-contained web server executable (one of the selling
>>> points of couchdb, actually).
>>>
>>> Kenny
>>>
>>>
>>> On Wed, Jul 20, 2011 at 6:38 PM, Tristan Sloughter <
>>> tristan.sloughter@REDACTED> wrote:
>>>
>>>> Kenny, yeah, thats what I was thinking of doing as a cache method if I
>>>> couldn't use something easily in front of Webmachine like Varnish (didn't
>>>> actually think of Varnish until Jesper brought it up. Maybe a bit of both...
>>>> Since while I don't want to use any templating on the backend, I want to end
>>>> up with a general web framework from all this.
>>>>
>>>> Tristan
>>>>
>>>>
>>>> On Wed, Jul 20, 2011 at 3:47 PM, Kenny Stone <kennethstone@REDACTED>wrote:
>>>>
>>>>> I wonder if an ets solution wouldn't be as good, as these solutions are
>>>>> just going to find some way of holding the data in memory anyways.  WIth
>>>>> ets, you can do things like hold compiled erlydtl/mustache templates inside
>>>>> of it...
>>>>>
>>>>> Kenny
>>>>>
>>>>>
>>>>> On Tue, Jul 19, 2011 at 11:47 AM, Garrett Smith <g@REDACTED> wrote:
>>>>>
>>>>>> If you're already using Nginx and just want control over URLs, you
>>>>>> have access to the standard rewrite module:
>>>>>>
>>>>>> http://wiki.nginx.org/HttpRewriteModule
>>>>>>
>>>>>> This is not 30x redirection btw, unless of course you want that.
>>>>>>
>>>>>> On Tue, Jul 19, 2011 at 9:24 AM, Tristan Sloughter
>>>>>> <tristan.sloughter@REDACTED> wrote:
>>>>>> > Sam, Jesper both these sound great, thanks! I'm also going to look
>>>>>> into what
>>>>>> > Jack was saying about how Rails handles some stuff.
>>>>>> > But I'm leaning towards Jesper's idea with Varnish being the best...
>>>>>> I'm one
>>>>>> > of those people who scoff at most benchmarks so not sure I'll bother
>>>>>> to do
>>>>>> > one for this, but maybe, if someone here can A) suggest the best
>>>>>> setup for
>>>>>> > it B) if it makes sense at all or would just be another worthless
>>>>>> benchmark
>>>>>> > that really gives no information about reality.
>>>>>> > Thanks!
>>>>>> > Tristan
>>>>>> > On Tue, Jul 19, 2011 at 7:00 AM, Jesper Louis Andersen
>>>>>> > <jesper.louis.andersen@REDACTED> wrote:
>>>>>> >>
>>>>>> >> On Tue, Jul 19, 2011 at 03:27, Tristan Sloughter
>>>>>> >> <tristan.sloughter@REDACTED> wrote:
>>>>>> >>
>>>>>> >> > Can anyone think of a way I can keep the nice URLs and serve the
>>>>>> static
>>>>>> >> > html
>>>>>> >> > files through nginx or another webserver.
>>>>>> >>
>>>>>> >> Put a Varnish accelerator in front of your system
>>>>>> >> (https://www.varnish-cache.org/). That way, it doesn't matter if
>>>>>> your
>>>>>> >> backend is slow at serving files as the accelerator will just cache
>>>>>> >> static stuff for you. In addition, you avoid the trouble of going
>>>>>> >> through another system as a proxy for static content. Also, the
>>>>>> >> solution is quite modular. On the development system, you don't
>>>>>> need
>>>>>> >> more than a single system running Erlang.
>>>>>> >>
>>>>>> >> In my opinion, there is little reason not to plug into the whole
>>>>>> >> industry there is where the main point is to make serving HTTP go
>>>>>> >> faster. Trying to beat that with Erlang is probably possible, but I
>>>>>> >> don't think it is beneficial. Varnish is really really hard to
>>>>>> beat.
>>>>>> >> It is built specifically for being insanely fast and it serves its
>>>>>> >> data from a shared mmap()'ing, scales to multiple CPUs and is a big
>>>>>> >> blob of nasty C code. I'd rather stand on the shoulders here than
>>>>>> >> trying to mess with it myself.
>>>>>> >>
>>>>>> >>
>>>>>> >> --
>>>>>> >> J.
>>>>>> >
>>>>>> >
>>>>>> > _______________________________________________
>>>>>> > erlang-questions mailing list
>>>>>> > erlang-questions@REDACTED
>>>>>> > http://erlang.org/mailman/listinfo/erlang-questions
>>>>>> >
>>>>>> >
>>>>>> _______________________________________________
>>>>>> erlang-questions mailing list
>>>>>> erlang-questions@REDACTED
>>>>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110722/3f747444/attachment.htm>


More information about the erlang-questions mailing list