codeigniter 和 colaphp :
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
server {
listen 80;
server_name
"你的域名或者IP"
;
access_log
/var/log/nginx/access
.log;
error_log
/var/log/nginx/error
.log;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504
/50x
.html;
location =
/50x
.html {
root html;
}
root
/var/www/
程序主目录;
location ~ \.(js|jpg|png|jpeg|png|gif|css)$ {
root
/var/www/CI
;
}
location / {
root
/var/www/
程序主目录;
index index.php index.html;
rewrite ^(.*)$
/index
.php/$1 last;
break
;
}
location ~ / {
fastcgi_param SCRIPT_FILENAME
/var/www/
程序主目录
/index
.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
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_param SCRIPT_NAME index.php;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI
/1
.1;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with –enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
}
|
ThinkPHP:
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
server {
listen 80;
server_name 你的IP或者域名;
access_log /
var
/log/nginx/access_book_reasono.log;
error_log
/
var
/log/nginx/error_book_reasono.log;
# redirect server error pages to the
static
page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
root /path/to/tp_dir;
location / {
root /path/to/tp_dir;
index index.php index.html;
rewrite ^(.*)$ /index.php/
$1
last;
break
;
}
location ~ / {
include
/etc/nginx/fastcgi_params;#注意你的nginx这个目录
fastcgi_param SCRIPT_FILENAME /path/to/tp_dir/index.php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO
$fastcgi_path_info
;
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_param SCRIPT_NAME index.php;
fastcgi_param REQUEST_URI
$request_uri
;
fastcgi_param DOCUMENT_URI
$document_uri
;
fastcgi_param DOCUMENT_ROOT
$document_root
;
fastcgi_param SERVER_PROTOCOL
$server_protocol
;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param REMOTE_ADDR
$remote_addr
;
fastcgi_param REMOTE_PORT
$remote_port
;
fastcgi_param SERVER_ADDR
$server_addr
;
fastcgi_param SERVER_PORT
$server_port
;
fastcgi_param SERVER_NAME
$server_name
;
# PHP only, required
if
PHP was built with –enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
}
}
#重启nginx服务,把ThinkPHP的URL_MODEL设置为2,访问下你的页面
|
WordPress:(严格意义上说这个不是框架吧?呵呵,whatever)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
server {
listen 80;
server_name 你的域名或者IP;
access_log
/var/log/nginx/access
.log;
error_log
/var/log/nginx/error
.log;
root
/var/www/
程序主目录;
location / {
index index.html index.htm index.php;
}
location ~ \.php$ {
include
/etc/nginx/fastcgi_params
;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/var/www/
程序主目录$fastcgi_script_name;
}
}
|