LNMP

tar -zxvf php-5.3.27.tar.gz

cd php-5.3.27


yum install openssl openssl-devel
 yum install curl curl-devel

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-pear --with-curl --with-openssl

make

make install

cp php.ini-production /usr/local/php/etc/php.ini

cd /usr/local/php/etc/

cp /usr/local/php/etc/php-fpm.conf.default php-fpm.conf

/usr/local/php/sbin/php-fpm -t

如果出现诸如 “test is successful” 字样,说明配置没有问题。

adduser hao

groupadd hao

useradd -g hao hao

vim /usr/local/php/etc/php-fpm.conf

user = hao

group = hao

cp php-fpm /etc/init.d/

chmod 755  /etc/init.d/php-fpm

service php-fpm start

检查是否启用:

netstat -ant|grep 9000


cd nginx-1.8.1

yum install pcre pcre-devel

./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module  --with-pcre

make

make install

ln -sf /usr/local/nginx/sbin/nginx /usr/sbin

测试:

nginx -t

cd /usr/local/nginx/conf/

> nginx.conf

vim nginx.conf

user nobody nobody;
worker_processes 2;
error_log /usr/local/nginx/logs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;

events
{
    use epoll;
    worker_connections 6000;
}

http
{
    include mime.types;
    default_type application/octet-stream;
    server_names_hash_bucket_size 3526;
    server_names_hash_max_size 4096;
    log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'
    '$host "$request_uri" $status'
    '"$http_referer" "$http_user_agent"';
    sendfile on;
    tcp_nopush on;
    keepalive_timeout 30;
    client_header_timeout 3m;
    client_body_timeout 3m;
    send_timeout 3m;
    connection_pool_size 256;
    client_header_buffer_size 1k;
    large_client_header_buffers 8 4k;
    request_pool_size 4k;
    output_buffers 4 32k;
    postpone_output 1460;
    client_max_body_size 10m;
    client_body_buffer_size 256k;
    client_body_temp_path /usr/local/nginx/client_body_temp;
    proxy_temp_path /usr/local/nginx/proxy_temp;
    fastcgi_temp_path /usr/local/nginx/fastcgi_temp;
    fastcgi_intercept_errors on;
    tcp_nodelay on;
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 8k;
    gzip_comp_level 5;
    gzip_http_version 1.1;
    gzip_types text/plain application/x-javascript text/css text/htm application/xml;

server
{
    listen 80;
    server_name localhost;
    index index.html index.htm index.php;
    root /usr/local/nginx/html;
    rewrite ^/ /hao/index.php;
    location ~ \.php$ {
        include fastcgi.conf;
        #rewrite ^/ /usr/local/nginx/html/hao/index.php last;
    fastcgi_pass 127.0.0.1:9000;
    }

}

}


nginx -s start

nginx -s reload

netstat -ant|grep 80

你可能感兴趣的:(LNMP)