欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

nginx fastcgi

程序员文章站 2024-02-21 11:07:46
...

nginx配置文件样例

worker_processes 4;
events {
    worker_connections 1024;   
}

http {
	//http负载均衡配置
    upstream backend {
        server 192.168.41.132:8888 weight=2;
        server 192.168.41.133:8888 weight=1;
    }

    server {
        listen 8888;
        server_name localhost;
        client_max_body_size 100m;
        location / {
            #root /home/grape/0voice/nginx_study/;
            #proxy_pass http://192.168.41.132:8888;
            proxy_pass http://backend;
        }

//nginx可以请求一个静态图片
        location /images/ {
                root /home/grape/0voice/nginx_study/;
        }
    }

    server {
        listen 9000;
//nginx也可以请求一个fastcgi的一个应用程序
        location ~ \.cgi {
            fastcgi_pass 127.0.0.1:9001;
            #fastcgi_index index.cgi;
            #fastcgi_param SCRIPT_FILENAME cgi$fastcgi_script_name;
            #include ../conf/fastcgi_params;
        }
    }
}


fastcgi程序必须使用cgi的库进行编写,编写好的程序使用spawn-fcgi进行启动 才能由nginx代理

相关标签: nginx 0voice