Slackware 14.0 install nginx +php-fpm
Публикувана от admin на October 08 2012 16:29:37
Slackware: install nginx +php-fpm cd /usr/src/ wget "http://sbopkg.googlecode.com/files/sbopkg-0.36.0-noarch-1_cng.tgz" installpkg sbopkg-0.36.0-noarch-1_cng.tgz
sbopkg


Search nginx > network/nginx http/imap/pop3 proxy > Build Build a package for nginx

nano /etc/nginx/nginx.conf

#user nobody;
worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

#gzip on;

server {
listen 80;
server_name localhost;
root /var/www/htdocs;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
# root html;
root /var/www/htdocs;
index index.php index.html index.htm;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}

location ~ \.php$ {
root /var/www/htdocs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME script$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;

# location / {
# root html;
# index index.html index.htm;
# }
#}


# HTTPS server
#
#server {
# listen 443;
# server_name localhost;

# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;

# ssl_session_timeout 5m;

# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# location / {
# root html;
# index index.html index.htm;
# }
#}

}



chmod +x /etc/rc.d/rc.nginx
/etc/rc.d/rc.nginx start




cd /var/www/htdocs/
pico index.html




Welcome to Nginx





http://localhost/index.html


pico /etc/nginx/nginx.conf


location ~ \.php$ {
root /srv/httpd/htdocs;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME script$fastcgi_script_name;
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}



chmod +x /etc/rc.d/rc.php-fpm

/etc/rc.d/rc.php-fpm start

cd /var/www/htdocs/
pico info.php

Link

Example #1 phpinfo() Example

http://localhost/info.php


pico /etc/rc.d/rc.local

# Start Nginx Web server;
if [ -x /etc/rc.d/rc.nginx ]; then
. /etc/rc.d/rc.nginx start
fi

# Start php-cgi;
if [ -x /usr/bin/php-cgi ]; then
. /etc/rc.d/rc.php-cgi start
fi