CentOS: Nginx配置 在线文档

FastDo是一个强大的C++跨平台开发库,能助您快速的开发服务端程序,Web应用及网页。

CentOS: Nginx配置

目前fastdo在linux上只能通过nginx运行(用Apache会有SCRIPT_FILENAME不准确的Bug,应该是它fcgi模块的原因)。下面展示一个CentOS平台下nginx网站配置文件的内容:

server {
    listen       80;
    server_name  your.domain.com;

    #gzip on;
    #charset koi8-r;
    access_log  /var/log/nginx/your.domain.com.access.log  main;

    root   /var/www/html/yoursite;

    location / {
        index  index.html index.do;
    }

    #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   /usr/share/nginx/html;
    }

    location ~ \.do$ {
        fastcgi_pass   127.0.0.1:9001;
        fastcgi_index  index.do;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ \.cpp$ {
        deny  all;
    }

    location ~ \.ecp$ {
        deny  all;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }

}

红色部分改成你自己的域名,蓝色部分改成你网站根目录的路径。之后重启nginx即可:

service nginx stop
service nginx start