清理nginx default.conf文件

时间:2012-11-19 00:38:38

标签: nginx

这是我配置的一部分:

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.*)$;
    fastcgi_pass backend;

    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /home/s/public_html$fastcgi_script_name;
    include fastcgi_params;
    fastcgi_param  QUERY_STRING     $query_string;
    fastcgi_param  REQUEST_METHOD   $request_method;

    fastcgi_param  CONTENT_TYPE     $content_type;
    fastcgi_param  CONTENT_LENGTH   $content_length;
    fastcgi_intercept_errors        on;
    fastcgi_ignore_client_abort     off;
    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 60;
    fastcgi_read_timeout 60;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 4 256k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
}

我有多个子域,我正在运行,每个子域我都要复制/粘贴这一大块代码。有什么方法可以让它重复使用吗?

1 个答案:

答案 0 :(得分:0)

通过将除fastcgi_pass和SCRIPT_FILENAME之外的所有内容放在单独的配置文件中来解决此问题。