在nginx中给每个站点分配不同的phpfpm的pool

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# pass the PHP scripts to FastCGI server listening on
# 127.0.0.1:9000
#
location ~ \.php$ {
    if (!-f $request_filename) {
        return 404;
    }
 
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in
    # php.ini
 
    # With php5-cgi alone:
    #fastcgi_pass 127.0.0.1:9000;
    # With php5-fpm: fastcgi_pass
    #unix:/var/run/php5-fpm.sock;
    fastcgi_pass unix:/var/run/php5-fpm-$poolname.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}
 
#pathinfo
location ~ \.php/ {
    if (!-f $document_root$fastcgi_script_name) {
        return 404;
    }
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in
    # php.ini
 
    # With php5-cgi alone:
    #fastcgi_pass 127.0.0.1:9000;
    # With php5-fpm: fastcgi_pass
    #unix:/var/run/php5-fpm.sock;
    fastcgi_pass unix:/var/run/php5-fpm-$poolname.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

使用仅需

set $poolname xxx;

include 这个文件名;

发表评论

注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)

本文链接:https://twd2.me/archives/4375QrCode