phpcgijs
Version:
Run and Execute PHP, JS, Ruby, Python 2, Python 3, ASPX, JSP, and CGI in CGI / Shell mode using node.js npm package / module. Includes cgijs npm module. `CGIJS` is a Nodejs Module/library to run any `CGI` mode/`Interpreted language script` files like PHP,
201 lines (161 loc) • 5.21 kB
Plain Text
user www www; ## Default: nobody
worker_processes 5; ## Default: 1
error_log logs/error.log;
pid logs/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096; ## Default: 1024
}
http {
# include conf/mime.types;
# include /etc/nginx/proxy.conf;
# include /etc/nginx/fastcgi.conf;
index index.html index.htm index.php;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
# server { # php/fastcgi
# listen 80;
# server_name domain1.com www.domain1.com;
# access_log logs/domain1.access.log main;
# root html;
# location ~ \.php$ {
# fastcgi_pass 127.0.0.1:1025;
# }
# }
server {
listen 9401 default_server;
listen [::]:9401 default_server;
server_name localhost;
root /www/html;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /www/html;
}
# serve static files
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /www/html/assets;
expires 30d;
}
}
server {
listen 9402;
listen [::]:9402;
server_name localhost;
root ./www/php;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /www/php;
}
# pass the PHP scripts to php5-fpm.sock listening on 127.0.0.1:9402
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# location ~ \.php$ {
# gzip off;
# include /etc/nginx/fastcgi_params;
# fastcgi_pass unix:/var/run/fcgiwrap.socket;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME C:\Users\gb\Documents\projects\github\cgi-js\www\php$fastcgi_script_name;
# }
}
server {
listen 9403;
listen [::]:9403;
server_name localhost;
root C:\Users\gb\Documents\projects\github\cgi-js\www\php;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root C:\Users\gb\Documents\projects\github\cgi-js\www\php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9403
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9403;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# On Ubuntu: apt-get install nginx fcgiwrap
# On Arch: pacman -S nginx fcgiwrap
server {
listen 9404;
listen [::]:9404;
server_name localhost;
root ./www/perl;
index index.pl index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /www/perl;
}
location ~ \.pl$ {
gzip off;
root /usr/lib;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fastcgi_params;
fastcgi_index index.pl;
# fastcgi_param SCRIPT_FILENAME /usr/lib$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME C:\Users\gb\Documents\projects\github\cgi-js\www\perl$fastcgi_script_name;
}
}
server {
listen 9405;
listen [::]:9405;
server_name localhost;
root ./www/ruby;
index index.rb index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /www/ruby;
}
location ~ \.rb$ {
gzip off;
root C:\Users\gb\Documents\projects\github\cgi-js\www\ruby;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include /etc/nginx/fastcgi_params;
fastcgi_index index.rb;
fastcgi_param SCRIPT_FILENAME C:\Users\gb\Documents\projects\github\cgi-js\www\ruby$fastcgi_script_name;
}
}
# # CHANGE
# $ sudo vi /etc/php5/fpm/pool.d/www.conf
# listen = 127.0.0.1:9000
# # TO
# $ sudo vi /etc/php5/fpm/pool.d/www.conf
# listen = /var/run/php5-fpm.sock
# sudo service php5-fpm start
# sudo service php5-fpm restart
# sudo service php5-fpm stop
}