LNMP installation Process

Source: Internet
Author: User

Nginx

Cd/data/samb

Tar ZXF php-5.4.45.tar.gz

Cd php-5.4.45.tar.gz

Yum Install libxml2-devel freetype-devellibjpeg-devel libpng-devel openssl-devel pcre pcre-devel libcurl-devel–y

Rpm-ivh "http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm"

Yum Install-y libmcrypt-devel

Install PHP

./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=/usr/local/mysql \

--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 \

--with-mcrypt \

--ENABLE-SOAP \

--ENABLE-GD-NATIVE-TTF \

--ENABLE-FTP \

--enable-mbstring \

--ENABLE-EXIF \

--enable-zend-multibyte \

--disable-ipv6 \

--with-pear \

--with-curl \

--with-openssl

Make && make install

Echo $?

no problem installing for 0

Cp

Nginx php-fpm-conf file

[Global]

PID =/usr/local/php/var/run/php-fpm.pid

Error_log =/usr/local/php/var/log/php-fpm.log

[WWW]

Listen =/tmp/www.sock listener file

user = php-fpm using users

Group = PHP-FPM

Listen.owner = Nobody

Listen.group = Nobody

PM = Dynamic Dynamics

Pm.max_children = 50

Pm.start_servers = 20

Pm.min_spare_servers = 5

Pm.max_spare_servers = 35

Pm.max_requests = 500

Rlimit_files = 1024

[WWW1]

Listen =/tmp/www1.sock

user = PHP-FPM

Group = PHP-FPM

PM = dynamic

Pm.max_children = 50

Pm.start_servers = 20

Pm.min_spare_servers = 5

Pm.max_spare_servers = 35

Pm.max_requests = 500

Rlimit_files = 10

Save exit

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

[29-sep-2015 07:50:57] Notice:configuration file/usr/local/php/etc/php-fpm.conf Test is successful

Check that the configuration file is correct Successful appears to be configured correctly

cp/data/samba/php-5.4.45/sapi/fpm/init.d.php-fpm/etc/init.d/php-fpm

Copy the boot file to the boot location

Chmod 755/ETC/INIT.D/PHP-FPM

To authorize the startup file

Add php-fpm to boot

Chkconfig PHP-FPM on

Start installing nginx

Cd/data/samba

Wget http://nginx.org/download/nginx-1.4.4.tar.gz

Tar Xzf nginx-1.4.4.tar.gz

Installing Nginx

./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

Cp/usr/local/nginx/conf/nginx.conf/usr/local/nginx/conf/nginx.conf.bak

>nginx.conf

Vim nginx.conf

nginx.conf configuration file

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_size1k;

LARGE_CLIENT_HEADER_BUFFERS8 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-javascripttext/css text/htm application/xml;

Include vhosts/*.conf;

}

Mkdir/usr/local/nginx/conf/vhosts–p Creating a Virtual Host folder

Cd vhosts

Vim default.conf

default.conf configuration for vhosts

Server

{

Listen default_server;

server_name localhost;

Index index.html index.htm index.php;

root/tmp/1234;

Deny all;

}

test.conf another file

~

User authentication

Server

{

Listen 80;

server_name www.test123.com;

Index index.html index.htm index.php;

root/data/www;

Location ~ \.php$ {

#fastcgi_pass 127.0.0.1:9000;

Fastcgi_pass Unix:/tmp/www.sock;

Fastcgi_index index.php;

Fastcgi_param Script_filename/data/www$fastcgi_script_name;

Include Fastcgi_params;

}

}

Server

{

Listen 80;

server_name www.test123.com;

Index index.html index.htm index.php;

root/data/www;

Location ~ \.*admin\.php$ {

Auth_basic "Aminglinux auth";

AUTH_BASIC_USER_FILE/USR/LOCAL/NGINX/CONF/.HTPASSWD;

Include Fastcgi_params;

Fastcgi_pass Unix:/tmp/www.sock;

# Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param Script_filename/data/www$fastcgi_script_name;

Include Fastcgi_params;

}

Location ~ \.php$ {

Include Fastcgi_params;

Fastcgi_pass Unix:/tmp/www.sock;

# Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param Script_filename/data/www$fastcgi_script_name;

Include Fastcgi_params;

}

}

if it is a certified directory the following PHP parsing can be commented out

Server

{

Listen 80;

server_name www.test123.com;

Index index.html index.htm index.php;

root/data/www;

location/abc/{ Note If adding location~ ^/abc/.* is to protect All files under the ABC directory

Auth_basic "Aminglinux auth";

AUTH_BASIC_USER_FILE/USR/LOCAL/NGINX/CONF/.HTPASSWD;

# include Fastcgi_params;

# Fastcgi_pass Unix:/tmp/www.sock;

# Fastcgi_pass 127.0.0.1:9000;

# Fastcgi_index index.php;

# Fastcgi_param Script_filename/data/www$fastcgi_script_name;

}

Location ~ \.php$ {

Include Fastcgi_params;

Fastcgi_pass Unix:/tmp/www.sock;

# Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param Script_filename/data/www$fastcgi_script_name;

}

}

Cluster environment

location/admin/{

Proxy_pass http://cluster/mgmt/;

Auth_basic " quanleiauth.";

AUTH_BASIC_USER_FILE/USR/LOCAL/NGNIX/CONF/AUTHDB;

}


This article is from the "Learn Linux" blog, so be sure to keep this source http://10265013.blog.51cto.com/10255013/1707895

LNMP installation Process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.