Last Updated: February 25, 2016
·
1.187K
· hyanwang

nginx for php

nginx有两种方式FastCGI从而实现php,第一种是unix的stock,另一种则是通过ip和端口实现。

debian7.1
/etc/php5/fpm/pool.d/www.conf

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses on a
;                            specific port;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
; listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:9000

/etc/nginx/sites-available/default

#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
#fastcgi_param SCRIPT_FILENAME /opt/www/$fastcgi_script_name;
include fastcgi_params;

1 Response
Add your response

You should filter the requests because it enforces PHP to parse all requests.

For example, someone uploads JPEG file with PHP code in EXIF. Then runs from URL and server is being exploited...

over 1 year ago ·