`

nginx spawn-fcgi php

阅读更多

安装spawn-fcgi

# emerge spawn-fcgi
 

安装nginx

# USE="pcre perl ssl zlib -addition -debug fastcgi -flv -imap -pop -random-index -realip -smtp static-gzip status -sub -webdav" emerge nginx
 

启动端口

# /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u uu -f /usr/bin/php-cgi
 

修改配置

# nano -w /etc/nginx/nginx.conf
{{{
 server {
        listen       80;
        server_name  localhost;

        root /var/www/localhost/htdocs;
        #index index.php index.html;
        location ~\.php$ {
                include        fastcgi.conf;
                include         fastcgi_params;
                }
        }

}}}

# nano -w /etc/nginx/fastcgi.conf
{{{

fastcgi_pass   127.0.0.1:9000;

set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
        set $real_script_name $1;
        set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}}}
 

启动

# /etc/init.d/nginx start
 

准备php测试文件

nano /var/www/localhost/htdocs/test.php
{
<?php
phpinfo();
?>
}
 



浏览成果
#visit in browser
http://192.168.0.111/test.php

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics