Apt-get Install libjpeg-devel libpng-devel freetype-devel libxml2-devel mysql-devel pcre-devel bzip2-devel
./configure–prefix=/usr/local/nginx–http-fastcgi-temp-path=/usr/local/nginx/fastcgi_temp/–http-proxy-temp-path =/usr/local/nginx/proxy_temp/–without-http_upstream_ip_hash_module–without-http_geo_module–without-http_ memcached_module–without-http_map_module–without-http_ssi_module–with-http_ssl_module–with-openssl=/usr/local/ Ssl/lib
Note that if you want to add SSL support, you need to compile with the version of OpenSSL 097. http://www.openssl.org/source/openssl-0.9.7m.tar.gz
Compiling PHP
./configure–prefix=/usr/local/php–enable-mbstring–with-mysql=/usr/–disable-dom–enable-fastcgi–with-gd– With-config-file-path=/usr/local/php/etc/–with-zlib-dir=/usr–with-jpeg-dir=/usr–with-png-dir=/usr–without-pear –without-sqlite–enable-force-cgi-redirect–with-freetype-dir–enable-fpm–with-fpm-conf=/usr/local/php/etc/ Fpm.conf–with-fpm-log=/usr/local/nginx/logs/fpm.log–with-fpm-pid=/usr/local/nginx/logs/fpm.pid
server {
Listen 80;
server_name xxx.net;
CharSet gb2312;
location/{
root/data/www/xxxx/;
index index.html index.htm index.php;
allow 1.1.1.1;
deny all;
}
Location ~ \.php$ {
root/data/www/xxxx/;
include/etc/fcgi.conf;
Fastcgi_pass 127.0.0.1:1026;
Fastcgi_index index.php;
}
}
where/etc/fcgi.conf content is
Fastcgi_param Gateway_interface cgi/1.1;
Fastcgi_param Server_software Nginx;
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_filename $document _root$fastcgi_script_name;
Fastcgi_param script_name $fastcgi _script_name;
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 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 is built With–enable-force-cgi-redirect
Fastcgi_param Redirect_status 200;
With Lighttpd's spawn-fcgi and spawn-php.sh.
#!/bin/bash
# # ABSOLUTE path to the spawn-fcgi binary
Spawnfcgi= "/usr/local/nginx/sbin/spawn-fcgi"
# # ABSOLUTE path to the PHP binary
Fcgiprogram= "/usr/local/bin/php-cgi"
# # TCP Port to which-bind on localhost
Fcgiport= "1026″
# # Number of PHP children to spawn
php_fcgi_children=10
# # Maximum number of requests a single PHP process can serve before it is restarted
php_fcgi_max_requests=1000
# # IP addresses from which PHP should access server connections
Fcgi_web_server_addrs= "127.0.0.1″
# Allowed environment variables, separated by spaces
allowed_env= "Oracle_home PATH USER"
# # If this script was run as root, switch to the following user
Userid=nobody
Groupid=nobody
Chongqi
#!/bin/bash
Killall-9 Nginx php-cgi; Sleep 1;/usr/local/nginx/sbin/spawn-php.sh; Nginx
"Turn" nginx+php