Welcome! Log In Create A New Profile

Advanced

PHP-FPM + PHP-5.2.14 + NGINX - Help! :)

Posted by kzap 
PHP-FPM + PHP-5.2.14 + NGINX - Help! :)
October 15, 2010 02:37AM
I've been slaving away trying to get PHP working via PHP-FPM. One of our servers is getting hit by slowloris and apache cant handle it.

I got NGINX running all fine and passing data back to apache but now Im trying to go pure NGINX atleast for most stuff.
I installed PHP-5.2.14 from source and patched with PHP-FPM for 5.14 with configured with the ff:[code]'./configure' '-enable-fastcgi' '--enable-fpm' '--build=x86_64-redhat-linux-gnu' '--host=x86_64-redhat-linux-gnu' '--target=x86_64-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib64' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib64' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--with-pear=/usr/share/pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr/include' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--with-mime-magic=/etc/httpd/conf/magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--without-tidy' '--with-mhash=shared,/usr' '--with-mcrypt=shared,/usr' '--without-mssql' '--without-oci8' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--disable-json'[/code]

ran php-fpm and setup the config properly to listen on 127.0.0.1:9000 , using the user apache since thats what most of my dirs are grouped into

I have the following fastcgi configuration for NGINX:[code]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 $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 GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

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;[/code]
and my NGINX site config:[code]server {
server_name website.com *.website.com;

access_log /var/log/nginx/website.com.access.log;
error_log /var/log/nginx/website.com.error.log;

root /home/website.com/public_html;

# if file doesnt exist pass to @proxy
location / {
try_files $uri $uri/ @proxy;
}

# dont log static images and set expiry
location ~* \.(jpeg|jpg|gif|png|css|js|ico)$ {
try_files $uri @proxy;
access_log off;
expires 7d;
}

# send php and other files to apache
location ~* \.(php|shtml)$ {
# proxy_pass http://127.0.0.1:8080;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
}

# proxy to Apache
location @proxy {
proxy_pass http://127.0.0.1:8080;
}
}[/code]
When i try to access a test php page i get a 404 response..... help please if anyone knows what I'm doing wrong :)

Thank you!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 138
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready