nginx服务器下编写cgi程序
程序员文章站
2024-04-06 17:42:31
...
本人使用的是Ubuntu系统复制 编译好的spawn-fcgi到 nginx目录
1、安装nginx服务器
http://nginx.org/download/nginx-1.9.2.tar.gz tar -zvxf nginx-1.9.2.tar.gz cd nginx ./configure make && make install
默认安装路径:/usr/local/nginx
nginx简单配置:/usr/local/nginx/conf/nginx.conf
#user nobody; worker_processes 4; 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; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 90; #gzip on; server { listen 192.168.88.134:8080; //修改成自己的ip地址跟端口 server_name 192.168.88.134; #charset koi8-r; access_log logs/host.access.log main; location / { root html; index index.html index.htm index.php; #autoindex on; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9999; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } location ~ \.cgi$ { root html; fastcgi_pass 127.0.0.1:7000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } }启动nginx:/usr/local/nginx/sbin/nginx
关闭nginx:kill `ps aux|grep nginx|sed -n '1p'| awk '{print $2}'`
2、安装spawn-fcgi
apt-get install apawn-fcgi3、安装fast-cgi
wget http://www.fastcgi.com/dist/fcgi.tar.gz
tar -xvzf fcgi.tar.gz
此时不能编译安装 cd fcgi-2.4.1/include 打开fcgio.h 添加#include./configure make && make install
推荐阅读
-
nginx服务器下编写cgi程序
-
Linux+Nginx+MySQL下配置论坛程序Discuz的基本教程
-
ubuntu下php开发环境搭建,nginx+(cgi)php5fpm+memcached+xdebug
-
PHP编写文件多服务器同步程序
-
在保护模式下编写程序
-
编写的vs2005水晶报表程序在vs2008下正常使用的一些实现方法
-
编写的vs2005水晶报表程序在vs2008下正常使用的一些实现方法
-
Eclipse下编写java程序突然不会自动生成R.java文件和包的解决办法
-
Eclipse下编写java程序突然不会自动生成R.java文件和包的解决办法
-
linux下centos中nginx配置一台服务器多个tomcat,多个域名