werc-1.5.0-tweaks

Tweaks for the werc website builder created by the mad architect Uriel
Log | Files | Refs | README

nginx.md (3327B)


      1 Setup werc with NGINX
      2 =====================
      3 
      4 You probably will want to to use fcgiwrap, called from spawn-fcgi or similar.
      5 
      6 Here is an extremely basic nginx configuration, with this configuration static files will be handled by werc and not nginx, this is clearly dumb, but works:
      7 
      8         worker_processes  1;
      9 
     10         #error_log  logs/error.log;
     11         #error_log  logs/error.log  notice;
     12         error_log  logs/error.log  info;
     13 
     14         pid        logs/nginx.pid;
     15 
     16         events {
     17             worker_connections  1024;
     18         }
     19 
     20 
     21         http {
     22         include       mime.types;
     23         default_type  application/octet-stream;
     24 
     25         #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
     26         #                  '$status $body_bytes_sent "$http_referer" '
     27         #                  '"$http_user_agent" "$http_x_forwarded_for"';
     28 
     29         #access_log  logs/access.log  main;
     30 
     31         sendfile        on;
     32         #tcp_nopush     on;
     33 
     34         #keepalive_timeout  0;
     35         keepalive_timeout  65;
     36 
     37         #gzip  on;
     38 
     39         server {
     40             listen       80;
     41             server_name  test.cat-v.org; # Replace with your domain name.
     42 
     43             #charset utf-8;
     44 
     45             #access_log  logs/host.access.log  main;
     46 
     47             location / {
     48 
     49             # FastCGI params, usually stored in fastcgi_params
     50             # and imported with a command like the following:
     51             #include        fastcgi_params;
     52 
     53             # Typical contents of fastcgi_params (inlined here):
     54             fastcgi_pass localhost:9000;
     55 
     56             fastcgi_param  QUERY_STRING       $query_string;
     57             fastcgi_param  REQUEST_METHOD     $request_method;
     58             fastcgi_param  CONTENT_TYPE       $content_type;
     59             fastcgi_param  CONTENT_LENGTH     $content_length;
     60 
     61             #fastcgi_param  SCRIPT_FILENAME   /var/www/werc/bin/werc.rc;
     62             fastcgi_param  SCRIPT_NAME        /var/www/werc/bin/werc.rc;
     63             #fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
     64 
     65             fastcgi_param  REQUEST_URI        $request_uri;
     66             fastcgi_param  DOCUMENT_URI       $document_uri;
     67             fastcgi_param  DOCUMENT_ROOT      $document_root;
     68             fastcgi_param  SERVER_PROTOCOL    $server_protocol;
     69 
     70             fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
     71             fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
     72 
     73             fastcgi_param  REMOTE_ADDR        $remote_addr;
     74             fastcgi_param  REMOTE_PORT        $remote_port;
     75             fastcgi_param  SERVER_ADDR        $server_addr;
     76             fastcgi_param  SERVER_PORT        $server_port;
     77             fastcgi_param  SERVER_NAME        $server_name;
     78             fastcgi_param  REMOTE_USER        $remote_user;
     79 
     80             #root   /var/www/werc/sites/$server_addr; # XXX This doesn't work, not sure why :(
     81             root /;
     82             #index  index.html index.htm;
     83             }
     84         }
     85     }
     86 
     87 
     88 Then you can use spawn-fcgi or similar to get wrapcgi going:
     89 
     90 	spawn-fcgi -a 127.0.0.1 -p 9000 -f /home/uriel/dvl/ext/fcgiwrap/fcgiwrap # Use the path to your fcgiwrap binary here
     91 
     92 
     93 Other Setups
     94 ------------
     95 
     96 More elaborate setups with direct handling of static files, caching, and multiple fcgi/cgi handlers should be easy, if you have any please post them to the werc9 mailing list.