I can't seem find any documentation, any blogposts or other resources about this subject.
From what I have seen so far there seems to be support for FastCGI
but the project hasn't had a commit for 4 years. And then mod_proxy
could probably be used. Maybe you can just run the Happstack application as a daemon which handles all the requests by itself.
I'm just guessing here, it would be really nice to see what people with experience say!
@Carl mentions this in his comment, so I'm going to specify my process in the hopes that it's useful for you. These are the steps on Debian linux with nginx as the server.
nginx
with apt-get install nginx
/etc/nginx/sites-available/your-app-name
containing.
server {
listen 80;
server_name your-app.com www.your-app.com your-app.ca;
rewrite .*/favicon.ico /img/favicon.ico last;
location ~ ^/(css|js|img|html)/ {
root /path/to/your/static/resource/folder;
expires 30d;
}
location / {
proxy_pass http://localhost:3000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
/etc/init.d/nginx restart
3000
(or substitute the appropriate port in the location
)I use this tactic to deploy most of my web apps, except for the Erlang-based ones; I trust Yaws to handle itself. Apparently some people are considering the same thing with warp, but I don't know enough about that to comment. The reverse proxy approach will work as long as the language you're running is able to respond to HTTP requests, which is a better bet than counting on (fast)?CGI
or the appropriate mod_.*?
.
Nginx is chosen as the server because it's faster than the alternatives at serving static files (which is pretty much all it's doing in this case), and because I find it really easy to configure. That's a preference not a rule. You could probably use Apache or Lighttpd or whatever in the same way, but I'll leave that explanation to someone more experienced with it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With