nginx+spawn-fcig+fastcgi+c++问题

写了程序换酒钱 2014-10-17 11:55:15
各位好,我使用nginx+fastcgi+c++,基于web http协议来进行客户端和服务器端的交互,我又两个cgi程序,分别为1.cgi和2.cgi,已经启动,我希望url路径中包含fcgi1.cgi,将请求交给1.cgi,对于2同理.

我的nginx配置

#nginx run on user group
user zhou adm;

# number of worker processes
worker_processes 2;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

error_log /home/zhou/nginx/log/error.log info;

pid /home/zhou/nginx/nginx.pid;


worker_rlimit_nofile 50000;

events {
use epoll;
worker_connections 50000;

}


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;
tcp_nodelay on;

#keepalive_timeout 0;
keepalive_timeout 120;

gzip on;
gzip_comp_level 2;

gzip_types text/plain application/x-javascript text/css application/xml;

server {
listen 80;
server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;


#C/C++ cgi program
#location ~ \.cgi$ {
# fastcgi_pass 127.0.0.1:9080;
# fastcgi_index index.cgi;
# fastcgi_param SCRIPT_FILENAME fastcgi_temp$fastcgi_script_name;
# include fastcgi_params;
#}

#location / {
# root html;
# index index.html index.htm;
#}


location /fcgi1.cgi$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}

location /fcgi2.cgi$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi_params;
}

#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:9000;
# 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;
#}
}


# 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 ssl;
# server_name localhost;

# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}


但是当我操作是,输入http://127.0.0.1/fcgi1.cgi时,没有执行

看log

2014/10/17 23:42:42 [error] 12434#0: *2 open() "/usr/local/nginx/html/fcgi1.cgi" failed (2: No such file or directory), client: 127.0.0.1, server: localhost, request: "GET /fcgi1.cgi HTTP/1.1", host: "127.0.0.1"
2014/10/17 23:44:37 [info] 12434#0: *2 client 127.0.0.1 closed keepalive connection

请教我配置那里有问题

...全文
2019 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

2,204

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 CGI
社区管理员
  • CGI社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧