Last active
November 14, 2015 21:43
-
-
Save jlav1n/50fc9cf94cd7ea5e8e4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fcgiwrap launcher, /etc/init.d/fcgiwrap | |
# see: https://github.com/gnosek/fcgiwrap | |
# and https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/ | |
# and: https://web.archive.org/web/20130324035657/http://nginx.localdomain.pl/wiki/FcgiWrap | |
# props: https://web.archive.org/web/20130322054803/http://www.tonimueller.org/blog/2012/09/hosting-interchange-on-nginx.html | |
# | |
#!/usr/bin/perl | |
use strict; | |
use warnings FATAL => qw( all ); | |
use IO::Socket::UNIX; | |
my $bin_path = '/usr/local/sbin/fcgiwrap'; | |
my $socket_path = $ARGV[0] || '/run/nginx/cgi.sock'; | |
my $num_children = $ARGV[1] || 1; | |
close STDIN; | |
unlink $socket_path; | |
my $socket = IO::Socket::UNIX->new( | |
Local => $socket_path, | |
Listen => 100, | |
); | |
die "Cannot create socket at $socket_path: $!\n" unless $socket; | |
for (1 .. $num_children) { | |
my $pid = fork; | |
die "Cannot fork: $!" unless defined $pid; | |
next if $pid; | |
exec $bin_path; | |
die "Failed to exec $bin_path: $!\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
# various other configs for this server. | |
# ic stuff, running as /cgi-bin/strap: | |
location /strap { | |
root /home/josh/www; | |
} | |
location /interchange-5 { | |
root /home/josh/www; | |
} | |
location ^~ /cgi-bin { | |
root /home/josh/www; | |
fastcgi_pass unix:/run/nginx/cgi.sock; | |
gzip off; | |
expires off; | |
set $path_info $request_uri; | |
if ($path_info ~ "^/cgi-bin/strap/([^\?]*)") { | |
set $path_info $1; | |
} | |
include fastcgi_params; | |
fastcgi_read_timeout 5m; | |
fastcgi_index /cgi-bin/strap; | |
fastcgi_param SERVER_SOFTWARE NginxEncoded/$nginx_version; # not in Toni's | |
fastcgi_param SCRIPT_NAME /cgi-bin/strap; | |
fastcgi_param SCRIPT_FILENAME /home/josh/cgi-bin/strap; | |
fastcgi_param PATH_INFO $path_info; | |
fastcgi_param HTTP_COOKIE $http_cookie; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment