Enterprise-php Nginx memcache

Source: Internet
Author: User


This experiment was based on the last experiment of the Enterprise-mysql Experiment (LNMP architecture)


First, install PHP

Download the installation package

php-5.6.20.tar.bz2
[[Email protected] ~]# tar jxf php-5.6.20.tar.bz2 unpacking

[[email protected] php-5.6.20]#/configure--help Find help
--with-openssl Specifying Drive Encryption

--WITH-GD Chart

--with-zlib PHP page Compression (anti-theft chain)

Components of the--with-pear function module (installation)

Installation dependencies

[email protected] ~]# Yum install libjpeg-turbo-devel-1.2.1-1.el6.x86_64
[email protected] php-5.6.20]# Yum install-y libxml2-devel
[email protected] php-5.6.20]# Yum install-y openssl-devel
[email protected] php-5.6.20]# Yum install-y curl-devel
[email protected] ~]# Yum install-y gd-devel-2.0.35-11.el6.x86_64.rpm
[email protected] ~]# Yum install-y gmp-devel
[email protected] ~]# Yum install libmcrypt-devel-2.5.8-9.el6.x86_64.rpm libmcrypt-2.5.8-9.el6.x86_64.rpm-y
[email protected] ~]# Yum install-y net-snmp-devel
[email protected] ~]# Yum install re2c-0.13.5-1.el6.x86_64.rpm-y

Perform

[Email protected] php-5.6.20]#/configure--prefix=/usr/local/lnmp/php--with-config-file-path=/usr/local/lnmp/ Php/etc--enable-mysqlnd--with-mysql=mysqlnd--with-mysqli=mysqlnd--with-pdo-mysql=mysqlnd--with-openssl-- With-snmp--with-gd--with-zlib--with-curl--with-libxml-dir--with-png-dir--with-jpeg-dir--with-freetype-dir-- With-pear--with-gettext--with-gmp--enable-inline-optimization--enable-soap--enable-ftp--enable-sockets-- Enable-mbstring--enable-fpm--with-fpm-user=nginx--with-fpm-group=nginx--with-mcrypt--with-mhash


[[email protected] php-5.6.20]# make && make install
Compile complete



Copying files to a specified path

[email protected] php-5.6.20]# CP Php.ini-production/usr/local/lnmp/php/etc/php.ini


[email protected] fpm]# CP INIT.D.PHP-FPM/ETC/INIT.D/PHP-FPM
[[email protected] fpm]# chmod +x/etc/init.d/php-fpm plus Execute permissions


Modify PHP configuration file




Open service, found error, said no user

According to the error, create a new user


Service Open


PHP Service Port 9000 port is open



Second, install Nginx


Download

Nginx-1.10.1.tar.gz
[[Email protected] ~]# tar zxf nginx-1.10.1.tar.gz unzip

Modify a file

[Email protected] core]# pwd
/root/nginx-1.10.1/src/core
[Email protected] core]# vim nginx.h

[Email protected] cc]# pwd
/root/nginx-1.10.1/auto/cc
[Email protected] cc]# vim gcc



Install dependencies before compiling

[email protected] nginx-1.10.1]# Yum install-y pcre-devel

To compile

[Email protected] nginx-1.10.1]#/configure--prefix=/usr/local/lnmp/nginx--with-http_ssl_module--with-http_stub _status_module--with-file-aio--with-threads--user=nginx--group=nginx

[[email protected] nginx-1.10.1]# make && make install



[[email protected] sbin]# ln-s/usr/local/lnmp/nginx/sbin/nginx/usr/local/sbin/do a soft connection

[[email protected] ~]# nginx-t detection syntax

Turn on services, view service ports

[[email protected] ~]# Nginx Open Service
[Email protected] ~]# NETSTAT-ANTLP


Modifying a configuration file

[Email protected] conf]# vim nginx.conf




[[email protected] conf]# nginx-t check syntax
[[email protected] conf]# Nginx-s Reload Reload


Create a page with Nginx access to the PHP home page


[Email protected] conf]# vim nginx.conf

[Email protected] conf]# nginx-t
[Email protected] conf]# Nginx-s Reload

Browser access




Iii. resolving dependencies between PHP and MySQL


Modifying a configuration file

[Email protected] etc]# vim php.ini


After modifying the file, reload


Iv. Building a forum based on LNMP


Download

Discuz_x3.2_sc_utf8.zip

[email protected] ~]# Yum install-y unzip

[[email protected] ~]# Unzip Discuz_x3.2_sc_utf8.zip decompression

Modify the extracted directory name




Ngnx setting up virtual host to implement domain-based access Nginx


Vim/usr/local/lnmp/nginx/conf/nginx.conf


Nginx-t detection

Nginx-s Reload Loading



Modify permissions as follows





[Email protected] conf]#/etc/init.d/mysqld restart


[Email protected] install]# mysql-p

mysql> show databases;
Mysql> Use Discuz
Mysql> Show tables;



V. Memcoache PHP-based cache


[email protected] ~]# Yum install-y memcached

Telnet

the Telnet protocol isTCP/IP protocola member of the family is the internetRemote Loginstandard protocols and primary methods of service. It provides the user with the complete remote on the local computerHostability to work. In theTerminalUse the Telnet program on the user's computer and use it to connect to theServer. TerminalUsers can enter commands in the Telnet program, and these commands areServerAs if it were entered directly on the console of the server. You can control it locally .Server. To start a Telnet session, you must enter a user name and password to log inServer. Telnet is common.Remote ControlWebServerthe method.


[email protected] ~]# Yum install telnet-y







[[email protected] bin]# VIM ~/.bash_profile environment variable


[Email protected] bin]# source ~/.bash_profile


[Email protected] ~]# tar zxf memcache-2.2.5.tgz




[Email protected] memcache-2.2.5]#/configure--prefix=/usr/local/lnmp/php/memcache

[[email protected] memcache-2.2.5]# make && make install




[[email protected] etc]# Vim php.ini Modify configuration file

Reload Service


Copy files

View ports


[Email protected] html]# vim example.php

[Email protected] html]# vim memcache.php




(MySQL, memcached, PHP, PHP-FPM, client-, Nginx)




Liu, Openresty

Openresty? is based on a Nginx A high-performance Web platform with LUA that integrates a large number of sophisticated Lua libraries, third-party modules, and most of the dependencies. For easy building of dynamic Web applications, Web services, and dynamic gateways capable of handling ultra-high concurrency and scalability

openresty? By bringing together a variety of well-designed Nginx module (developed primarily by the Openresty team) to Nginx effectively become a powerful universal WEB application platform. In this way, web developers and system engineers can use the Lua scripting language to mobilize the various C and LUA modules supported by Nginx to quickly construct high-performance WEB applications that are capable of concurrent connections of up to 10K and even more than 1000K Ec

The goal of Openresty is to get your Web services running directly Nginx within the service, make full use Nginx non-blocking I/O model, not only for HTTP client requests, but also for consistent high-performance response to remote backend such as MySQL, PostgreSQL, Memcached, and Redis.


Download the installation package

Openresty-1.13.6.1.tar.gz

[[Email protected] ~]# tar zxf openresty-1.13.6.1.tar.gz unzip

[Email protected] openresty-1.13.6.1]# Gmake
[Root[email protected] openresty-1.13.6.1]# gmake Install


[[email protected] nginx]# nginx-s stop before you turn off the Nginx service


Browser access to the host




[[email protected] conf]# Vim nginx.conf Modify configuration file



Write the page, change the order of access






Enterprise-php Nginx memcache

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.