Skip to content

Instantly share code, notes, and snippets.

@rjp
Created December 2, 2011 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjp/1422845 to your computer and use it in GitHub Desktop.
Save rjp/1422845 to your computer and use it in GitHub Desktop.
openresty configuration that doesn't work
#user nobody;
worker_processes 1;
## safe for use under daemontools
daemon off;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
perl_modules /etc/nginx/perl/lib;
perl_require dumper.pm;
sendfile on;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
}
# special endpoint for iPhone remote diagnostics
location /dump {
perl dumper::handler;
}
}
}
http {
upstream database {
postgres_server 127.0.0.1:5432 dbname=scribot
user=USERNAME password=PASSWORD;
}
server {
listen 8080;
location /urls {
rds_json on;
rds_json_root url;
postgres_query GET "SELECT * FROM urls ORDER BY id DESC LIMIT 10";
postgres_pass database;
postgres_output rds;
}
location ~ /url/(?<num>\d+) {
rds_json on;
rds_json_root url;
postgres_query GET "SELECT * FROM urls WHERE id=$num";
postgres_pass database;
postgres_output rds;
}
}
}
http {
perl_modules /etc/nginx/perl/lib;
perl_require mailauth.pm;
server {
listen 8099;
server_name mailproxy.pi.st;
server_name new.frottage.org;
access_log /var/log/nginx/mailproxy.access.log;
location /auth {
perl mailauth::handler;
}
location /dump {
perl dumper::handler;
}
}
}
mail {
auth_http 127.0.0.1:8099/auth;
pop3_capabilities "TOP" "USER";
imap_capabilities "IMAP4rev1" "UIDPLUS";
server {
listen 110;
protocol pop3;
proxy on;
}
server {
listen 143;
protocol imap;
proxy on;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment