Linux Server architecture tengine2+mysql5.6+php5.5 Environment Tutorial

Source: Internet
Author: User
Tags fpm install php imagemagick openssl sleep socket touch iptables

First, the library needed to upgrade

Sudo-s
Lang=c
Yum install-y wget gcc gcc-c++ openssl* Curl curl-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel gd GD2 Gd-devel gd2-devel libaio autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

Second, the creation of directory disease download required software:

Create two directories for the software source directory and log directory, and then download the software.

Mkdir-p/lvtao.net/resource
Mkdir-p/lvtao.net/logs
cd/lvtao.net/resource/
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz
wget http://tengine.taobao.org/download/tengine-2.0.1.tar.gz
wget downloads.skysql.com/archives/mysql-5.6/mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz
wget http://cn2.php.net/distributions/php-5.5.12.tar.gz
wget http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz
wget http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz
wget http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz
wget http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
wget http://pecl.php.net/get/memcache-2.2.7.tgz
wget http://mirrors-au.go-parts.com/mirrors/ImageMagick/ImageMagick-6.8.9-1.tar.gz
wget http://pecl.php.net/get/imagick-3.1.2.tgz

Iii. installation of Tengine

① installation Pcre

Tar zxvf pcre-8.35.tar.gz
CD pcre-8.35
./configure
Make && make install
Cd.. /

② installation Tengine

Groupadd www
Useradd-g www www
Tar zxvf tengine-2.0.1.tar.gz
CD tengine-2.0.1
./configure--user=www--group=www--prefix=/lvtao.net/software/nginx--with-http_stub_status_module--with-http_ Ssl_module--with-pcre=/lvtao.net/resource/pcre-8.35--with-http_realip_module--with-http_image_filter_module-- With-http_concat_module
Make
Make install
Cd.. /

③ Configure domain Name

Rm-f/lvtao.net/software/nginx/conf/nginx.conf
Vi/lvtao.net/software/nginx/conf/nginx.conf

Enter the following (the folder sites-enabled is stored in the virtual host configuration file, located in Mkdir-p/lvtao.net/software/nginx/sites-enabled/)

User www www.


Worker_processes Auto;





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





gzip on;


Gzip_disable "Msie6";


Gzip_vary on;


Gzip_proxied any;


Gzip_comp_level 6;


Gzip_min_length 1100;


Gzip_buffers 8k;


Gzip_http_version 1.1;


Gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml Application/xml+rss Text/javascript;





Access_log off;


Log_not_found off;


Error_log/lvtao.net/logs/nginx-error.log warn;


# Access_log/lvtao.net/logs/nginx-access.log main buffer=16k;


Server_admin admin@bugxm.com;


Server_tag apache/2.4;


Log_format Main ' $remote _addr-$remote _user [$time _local] ' $request '


' $status $body _bytes_sent ' $http _referer '


' $http _user_agent ', ' $http _x_forwarded_for ';





Open_file_cache max=200000 inactive=20s;


Open_file_cache_valid 30s;


Open_file_cache_min_uses 2;


Open_file_cache_errors on;





Client_max_body_size 10M;


Client_body_buffer_size 1m;


Client_body_timeout 15;


Client_header_timeout 15;


Client_header_buffer_size 32k;


Keepalive_timeout 2 2;


Send_timeout 15;


Sendfile on;


Tcp_nopush on;


Tcp_nodelay on;





Fastcgi_buffers 256 16k;


Fastcgi_buffer_size 128k;


Fastcgi_connect_timeout 3s;


Fastcgi_send_timeout 120s;


Fastcgi_read_timeout 120s;


Reset_timedout_connection on;


Server_names_hash_bucket_size 100;





Server_tokens off;





server {


Listen 80;


server_name localhost;


Index index.html index.htm index.php;


root/lvtao.net/htdocs/test/;





Error_page 404/404.html;


Error_page 502 503 504/50x.html;


Location =/50x.html {


root HTML;


}





Location ~. *. (PHP|PHP5)? $ {


#fastcgi_pass Unix:/tmp/php-cgi.sock;


Fastcgi_pass 127.0.0.1:9000;


Fastcgi_index index.php;


Include fastcgi.conf;


}





Location ~. *. (Gif|jpg|jpeg|png|bmp|swf|ico) $


{


Expires 30d;


}





Location ~. *. (JS|CSS)? $


{


Expires 1h;


}





Location ~/. {


Deny all;


}


}


Include. /sites-enabled/*.conf;


}

Generate PHP test content for installation and completion test:

Mkdir-p/lvtao.net/htdocs/test
chmod +w/lvtao.net/htdocs/test
echo "<?php phpinfo ();?>" >/lvtao.net/htdocs/test/index.php
Chown-r Www:www/lvtao.net/htdocs/test

Edit fastcgi.conf

Vi/lvtao.net/software/nginx/conf/fastcgi.conf

For security reasons, add the following code at the bottom of the fastcgi.conf:

Fastcgi_param php_value "open_basedir= $document _root:/tmp/:/proc/";

④ add tengine to the service

Vi/etc/rc.d/init.d/nginx

Add the following content to the file

#!/bin/sh


# Source function library.


. /etc/rc.d/init.d/functions


# Source Networking configuration.


. /etc/sysconfig/network


# Check that networking are up.


["$NETWORKING" = "no"] &amp;&amp; exit 0


nginx= "/lvtao.net/software/nginx/sbin/nginx"


prog=$ (basename $nginx)


Nginx_conf_file= "/lvtao.net/software/nginx/conf/nginx.conf"


[-f/etc/sysconfig/nginx] &amp;&amp;. /etc/sysconfig/nginx


Lockfile=/var/lock/subsys/nginx


Make_dirs () {


# Make required Directories


User= ' $nginx-v 2&gt;&amp;1 | grep "Configure arguments:" | Sed ' s/[^*]*--user= ([^]*). */1/g '-'


If [-Z "' grep $user/etc/passwd ']"; Then


Useradd-m-s/bin/nologin $user


Fi


Options= ' $nginx-v 2&gt;&amp;1 | grep ' Configure arguments: '


for opt in $options; Todo


If [' Echo $opt | grep '. *-temp-path ']; Then


Value= ' echo $opt | Cut-d "=" F 2 '


if [!-D "$value"]; Then


# echo "Creating" $value


Mkdir-p $value &amp;&amp; chown-r $user $value


Fi


Fi


Done


}


Start () {


[x $nginx] | | Exit 5


[f $NGINX _conf_file] | | Exit 6


Make_dirs


Echo-n $ "Starting $prog:"


Daemon $nginx-C $NGINX _conf_file


Retval=$?


Echo


[$retval-eq 0] &amp;&amp; Touch $lockfile


Return $retval


}


Stop () {


Echo-n $ "Stopping $prog:"


Killproc $prog-quit


Retval=$?


Echo


[$retval-eq 0] &amp;&amp; rm-f $lockfile


Return $retval


}


Restart () {


Configtest | | Return $?


Stop


Sleep 1


Start


}


Reload () {


Configtest | | Return $?


Echo-n $ "Reloading $prog:"


Killproc $nginx-hup


Retval=$?


Echo


}


Force_reload () {


Restart


}


Configtest () {


$nginx-T-C $NGINX _conf_file


}


Rh_status () {


Status $prog


}


Rh_status_q () {


Rh_status &gt;/dev/null 2&gt;&amp;1


}


Case "$" in


Start


Rh_status_q &amp;&amp; Exit 0


$


;;


Stop


Rh_status_q | | Exit 0


$


;;


Restart|configtest)


$


;;


Reload


Rh_status_q | | Exit 7


$


;;


Force-reload)


Force_reload


;;


Status


Rh_status


;;


Condrestart|try-restart)


Rh_status_q | | Exit 0


;;


*)


echo $ "Usage: $ {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"


Exit 2


Esac

chmod +x/etc/init.d/nginx
Ulimit-shn 65535
Service Nginx Start

Note: Boot parameter support: {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}

Four, install MySQL

Tar zxvf mysql-5.6.16-linux-glibc2.5-x86_64.tar.gz
MV Mysql-5.6.16-linux-glibc2.5-x86_64/lvtao.net/software/mysql
Groupadd MySQL
useradd-g MySQL MySQL
Mkdir-p/lvtao.net/data/mysql/data/
Mkdir-p/lvtao.net/data/mysql/binlog/
Mkdir-p/lvtao.net/data/mysql/relaylog/
Chown-r mysql:mysql/lvtao.net/data/mysql/

/lvtao.net/software/mysql/scripts/mysql_install_db--basedir=/lvtao.net/software/mysql--datadir=/lvtao.net/data /mysql/data--user=mysql

Sed-i "S#/usr/local/mysql#/lvtao.net/software/mysql#g"/lvtao.net/software/mysql/bin/mysqld_safe

Edit configuration file my.cnf

Rm-f/lvtao.net/software/mysql/my.cnf
Vi/lvtao.net/software/mysql/my.cnf

Enter the following in MY.CNF

[Client]


Character-set-server = UTF8


Port = 3306


Socket =/tmp/mysql.sock





[Mysqld]


Server-id = 1


Port = 3306


user = MySQL


Basedir =/lvtao.net/software/mysql


DataDir =/lvtao.net/data/mysql/data


Socket =/tmp/mysql.sock


Log-error =/lvtao.net/data/mysql/mysql_error.log


Pid-file =/lvtao.net/data/mysql/mysql.pid


Sql_mode=no_engine_substitution,strict_trans_tables





Open_files_limit = 10240


Back_log = 600


Join_buffer_size = 1M


Read_rnd_buffer_size = 16M


Sort_buffer_size = 1M


Thread_cache_size = 300


Query_cache_size = 128M


Query_cache_limit = 2M


Query_cache_min_res_unit = 2k


Default-storage-engine = MyISAM


Thread_stack = 192K


Transaction_isolation = read-committed


Tmp_table_size = 246M


Max_heap_table_size = 246M


Long_query_time = 3


Log-slave-updates


Log-bin =/lvtao.net/data/mysql/binlog/binlog


Binlog_cache_size = 4M


Binlog_format = MIXED


Max_binlog_cache_size = 8M


Max_binlog_size = 1G


Relay-log-index =/lvtao.net/data/mysql/relaylog/relaylog


Relay-log-info-file =/lvtao.net/data/mysql/relaylog/relaylog


Relay-log =/lvtao.net/data/mysql/relaylog/relaylog


Expire_logs_days = 30


Key_buffer_size = 128M


Read_buffer_size = 1M


Read_rnd_buffer_size = 16M


Bulk_insert_buffer_size = 64M


Myisam_sort_buffer_size = 128M


Myisam_max_sort_file_size = 10G


Myisam_repair_threads = 1


Myisam_recover





Interactive_timeout = 120


Wait_timeout = 120





Skip-name-resolve


Slave-skip-errors = 1032,1062,126,1114,1146,1048,1396

Adding MySQL to a service

Vi/etc/rc.d/init.d/mysqld

Enter the following content

#!/bin/sh


Basedir=/lvtao.net/software/mysql


Datadir=/lvtao.net/data/mysql/data


service_startup_timeout=900


Lockdir= '/var/lock/subsys '


Lock_file_path= "$lockdir/mysql"


Mysqld_pid_file_path=/lvtao.net/data/mysql/mysql.pid


If Test-z "$basedir"


Then


Basedir=/usr/local/mysql


Bindir=/usr/local/mysql/bin


If Test-z "$datadir"


Then


Datadir=/usr/local/mysql/data


Fi


Sbindir=/usr/local/mysql/bin


Libexecdir=/usr/local/mysql/bin


Else


Bindir= "$basedir/bin"


If Test-z "$datadir"


Then


Datadir= "$basedir/data"


Fi


Sbindir= "$basedir/sbin"


Libexecdir= "$basedir/libexec"


Fi


datadir_set=


Lsb_functions= "/lib/lsb/init-functions"


If Test-f $lsb _functions; Then


. $LSB _functions


Else


Log_success_msg ()


{


echo "success! $@"


}


Log_failure_msg ()


{


echo "error! $@"


}


Fi





Path= "/sbin:/usr/sbin:/bin:/usr/bin: $basedir/bin"


Export PATH





Mode=$1 # Start or stop





[$#-ge 1] &amp;&amp; shift








Other_args= "$*" # uncommon, but needed when called to an RPM upgrade action


# expected: "--skip-networking--skip-grant-tables"


# They are not checked here, intentionally, as it's the resposibility


# of the "spec" file author to give correct arguments only.





Case ' echo ' TESTINGC ', ' echo-n testing '


*c*,-n*) echo_n= echo_c=;;


*c*,*) echo_n=-n echo_c=;;


*) echo_n= echo_c= ' C ';;


Esac





Parse_server_arguments () {


For Arg do


Case "$arg" in


--basedir=*) basedir= ' echo ' $arg | Sed-e ' s/^[^=]*=//'


Bindir= "$basedir/bin"


If Test-z "$datadir _set"; Then


Datadir= "$basedir/data"


Fi


Sbindir= "$basedir/sbin"


Libexecdir= "$basedir/libexec"


;;


--datadir=*) datadir= ' echo ' $arg | Sed-e ' s/^[^=]*=//'


Datadir_set=1


;;


--pid-file=*) mysqld_pid_file_path= ' echo ' $arg | Sed-e ' s/^[^=]*=//';;


--service-startup-timeout=*) service_startup_timeout= ' echo ' $arg | Sed-e ' s/^[^=]*=//';;


Esac


Done


}





Wait_for_pid () {


Verb= "$" # Created | Removed


Pid= "$" # Process ID of the program operating on the Pid-file


Pid_file_path= "$" # path to the PID file.





I=0


Avoid_race_condition= "by checking again"





While test $i-ne $service _startup_timeout; Todo





Case "$verb" in


' Created ')


# Wait for a pid-file to pops into existence.


Test-s "$pid _file_path" &amp;&amp; i= ' &amp;&amp; break


;;


' Removed ')


# Pid-file to disappear


Test! -S "$pid _file_path" &amp;&amp; i= ' &amp;&amp; break


;;


*)


echo "Wait_for_pid () usage:wait_for_pid created|removed pid Pid_file_path"


Exit 1


;;


Esac





# if server isn ' t running, then pid-file'll never be updated


If Test-n "$pid"; Then


If kill-0 "$pid" 2&gt;/dev/null; Then


: # The server still runs


Else


# The server may have exited between the last Pid-file check and now.


If Test-n "$avoid _race_condition"; Then


Avoid_race_condition= ""


Continue # Check again.


Fi





# there ' s nothing, that'll affect the file.


Log_failure_msg "The server quit without updating PID file ($pid _file_path)."


Return 1 # No more waiting.


Fi


Fi





echo $echo _n ". $echo _c"


i= ' expr $i + 1 '


Sleep 1





Done





If Test-z "$i"; Then


Log_success_msg


return 0


Else


Log_failure_msg


Return 1


Fi


}





# get arguments from the my.cnf file,


# The only group, which is ' read from ' Now ' is [mysqld]


If Test-x./bin/my_print_defaults


Then


Print_defaults= "./bin/my_print_defaults"


Elif test-x $bindir/my_print_defaults


Then


print_defaults= "$bindir/my_print_defaults"


Elif test-x $bindir/mysql_print_defaults


Then


print_defaults= "$bindir/mysql_print_defaults"


Else


# Try to find Basedir in/etc/my.cnf


Conf=/etc/my.cnf


print_defaults=


If Test-r $conf


Then


Subpat= ' ^[^=]*basedir[^=]*= (. *) $ '


dirs= ' sed-e '/$subpat/!d '-e ' s//1/' $conf '


For D in $dirs


Todo


D= ' echo $d | Sed-e ' s/[]//g '


If Test-x "$d/bin/my_print_defaults"


Then


print_defaults= "$d/bin/my_print_defaults"


Break


Fi


If Test-x "$d/bin/mysql_print_defaults"


Then


print_defaults= "$d/bin/mysql_print_defaults"


Break


Fi


Done


Fi





# Hope It ' s in the PATH ... but I doubt it


Test-z "$print _defaults" &amp;&amp; print_defaults= "My_print_defaults"


Fi





#


# Read defaults file from ' Basedir '. If There is no defaults file there


# Check if it ' s in the old (depricated) place (DataDir) and read it from there


#





Extra_args= ""


If Test-r "$basedir/my.cnf"


Then


Extra_args= "-E $basedir/my.cnf"


Else


If Test-r "$datadir/my.cnf"


Then


Extra_args= "-E $datadir/my.cnf"


Fi


Fi





Parse_server_arguments ' $print _defaults $extra _args mysqld server Mysql_server mysql.server '





#


# Set PID file if not given


#


If Test-z "$mysqld _pid_file_path"


Then


Mysqld_pid_file_path= $datadir/' hostname '. PID


Else


Case "$mysqld _pid_file_path" in


/* ) ;;


* mysqld_pid_file_path= "$datadir/$mysqld _pid_file_path";;


Esac


Fi





Case "$mode" in


' Start ')


# Start Daemon





# Safeguard (relative paths, core dumps ...)


CD $basedir





Echo $echo _n "Starting MySQL"


If Test-x $bindir/mysqld_safe


Then


# give extra arguments to mysqld with the my.cnf file. This script


# May is overwritten at next upgrade.


$bindir/mysqld_safe--datadir= "$datadir"--pid-file= "$mysqld _pid_file_path" $other _args &gt;/dev/null 2&gt;&amp;1 &amp;


Wait_for_pid created "$!" "$mysqld _pid_file_path"; Return_value=$?





# Make lock for Redhat/suse


If Test-w "$lockdir"


Then


Touch "$lock _file_path"


Fi





Exit $return _value


Else


Log_failure_msg "couldn ' t find MySQL server ($bindir/mysqld_safe)"


Fi


;;





' Stop ')


# Stop Daemon. We use a signal avoid has to know the


# root password.





If Test-s "$mysqld _pid_file_path"


Then


Mysqld_pid= ' cat ' $mysqld _pid_file_path '





if (kill-0 $mysqld _pid 2&gt;/dev/null)


Then


echo $echo _n "shutting down MySQL"


Kill $mysqld _pid


# mysqld should remove the PID file when it exits.


Wait_for_pid removed "$mysqld _pid" "$mysqld _pid_file_path"; Return_value=$?


Else


Log_failure_msg "MySQL Server process # $mysqld _pid is not running!"


RM "$mysqld _pid_file_path"


Fi





# Delete Lock for Redhat/suse


If Test-f "$lock _file_path"


Then


Rm-f "$lock _file_path"


Fi


Exit $return _value


Else


Log_failure_msg "MySQL Server PID file could not being found!"


Fi


;;





' Restart ')


# Stop the service and regardless of whether it was


# Running or not, start it again.


If $ stop $other _args; Then


$ start $other _args


Else


Log_failure_msg "Failed to stop running server, so refusing to try to start."


Exit 1


Fi


;;





' Reload ' | Force-reload ')


If Test-s "$mysqld _pid_file_path"; Then


Read Mysqld_pid &lt; "$mysqld _pid_file_path"


Kill-hup $mysqld _pid &amp;&amp; log_success_msg "reloading service MySQL"


Touch "$mysqld _pid_file_path"


Else


Log_failure_msg "MySQL PID file could not being found!"


Exit 1


Fi


;;


' Status ')


# A check to the IF PID file exists


If Test-s "$mysqld _pid_file_path"; Then


Read Mysqld_pid &lt; "$mysqld _pid_file_path"


If kill-0 $mysqld _pid 2&gt;/dev/null; Then


Log_success_msg "MySQL running ($mysqld _pid)"


Exit 0


Else


Log_failure_msg "MySQL is not running, but PID file exists"


Exit 1


Fi


Else


# Try to find appropriate mysqld process


Mysqld_pid= ' pidof $libexecdir/mysqld '





# test if multiple PIDs exist


Pid_count= ' echo $mysqld _pid | Wc-w '


if test $pid _COUNT-GT 1; Then


Log_failure_msg "multiple MySQL running but PID file could not be found ($mysqld _pid)"


Exit 5


Elif test-z $mysqld _pid; Then


If Test-f "$lock _file_path"; Then


Log_failure_msg "MySQL is not running, but lock file ($lock _file_path) exists"


Exit 2


Fi


Log_failure_msg "MySQL is not running"


Exit 3


Else


Log_failure_msg "MySQL is running but PID file could don't be found"


Exit 4


Fi


Fi


;;


*)


# usage


Basename= ' basename ' "$"


echo "Usage: $basename {start|stop|restart|reload|force-reload|status} [MySQL server Options]"


Exit 1


;;


Esac





Exit 0

Give permission

chmod +x/etc/init.d/mysqld
Service mysqld Start

Log in with the root account and make a simple security setting, type the following code and return directly to:

/lvtao.net/software/mysql/bin/mysql-uroot-p

1. Modify Root Password

UPDATE mysql.user SET Password=password (' Your Password here ') WHERE user= ' root ';

2. Delete Unknown users

DELETE from Mysql.user WHERE user= ';

3. Delete Root remote access

DELETE from Mysql.user WHERE user= ' root ' and Host not in (' localhost ', ' 127.0.0.1 ', ':: 1 ');

4. Delete the "test" database

DROP database test;

5. Take immediate effect and exit the MySQL command form

FLUSH privileges; QUIT;

V. Installation of PHP

① the dependent libraries required to install PHP

Tar zxvf libmcrypt-2.5.8.tar.gz
CD libmcrypt-2.5.8/
./configure
Make
Make install
/sbin/ldconfig
CD libltdl/
./configure--enable-ltdl-install
Make
Make install
Cd.. /.. /

Tar zxvf mhash-0.9.9.9.tar.gz
CD mhash-0.9.9.9/
./configure
Make
Make install
Cd.. /

Tar zxvf mcrypt-2.6.8.tar.gz
CD mcrypt-2.6.8/
Export Ld_library_path=/usr/local/lib: $LD _library_path
./configure
Make
Make install
Cd.. /

Edit ld.so.conf:

Vi/etc/ld.so.conf

Add at the bottom:

/usr/lib
/usr/lib64

And then:

Ldconfig

② Install PHP

Tar zxvf php-5.5.12.tar.gz


CD php-5.5.12/


Export Dyld_library_path= "/lvtao.net/software/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/ Usr/local/lib64 "


Export Ld_library_path= "/lvtao.net/software/mysql/lib/:/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/ Local/lib64 "


Ln-s/lvtao.net/software/mysql/lib/libmysqlclient.so.18/usr/lib64/libmysqlclient.so.18


./configure--prefix=/lvtao.net/software/php--with-config-file-path=/lvtao.net/software/php/etc--with-mysql=/ Lvtao.net/software/mysql--with-mysqli=/lvtao.net/software/mysql/bin/mysql_config--with-iconv-dir-- With-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml-- Enable-bcmath--enable-shmop--enable-sysvsem--enable-inline-optimization--with-curl--enable-mbregex --enable-mbstring--with-mcrypt--with-gd--enable-gd-native-ttf--with-openssl--with-mhash-- Enable-sockets--with-xmlrpc--enable-zip--enable-soap--enable-opcache--with-pdo-mysql


Make


Make install





CP Php.ini-development/lvtao.net/software/php/etc/php.ini


Cd.. /

③ Install PHP Extensions

Tar zxvf memcache-2.2.7.tgz


CD memcache-2.2.7/


/lvtao.net/software/php/bin/phpize


./configure--with-php-config=/lvtao.net/software/php/bin/php-config


Make


Make install


Cd.. /





Tar zxvf imagemagick-6.8.9-1.tar.gz


CD imagemagick-6.8.9-1/


./configure


Make


Make install


Cd.. /





Tar zxvf imagick-3.1.2.tgz


CD IMAGICK-3.1.2/


/lvtao.net/software/php/bin/phpize


./configure--with-php-config=/lvtao.net/software/php/bin/php-config


Make


Make install


Cd.. /





Sed-i ' s#; Extension_dir = "./" #extension_dir = "/lvtao.net/software/php/lib/php/extensions/no-debug-zts-20121212/" nextension = "memcache.so" N#g '/lvtao.net/software/php/etc/php.ini


Sed-i "s#;d ate.timezone = #date. TimeZone = asia/shanghai#g"/lvtao.net/software/php/etc/php.ini


Sed-i "S#;cgi.fix_pathinfo=1#cgi.fix_pathinfo=0#g"/lvtao.net/software/php/etc/php.ini





Sed-i "s#expose_php = on#expose_php = off#g"/lvtao.net/software/php/etc/php.ini


Sed-i "S#;error_log = php_errors.log#error_log=/lvtao.net/logs/php_scripts_error.log#g"/lvtao.net/software/php/ Etc/php.ini


Sed-i "S#allow_url_fopen = On#allow_url_fopen = off#g"/lvtao.net/software/php/etc/php.ini


Sed-i "S#sql.safe_mode=off#sql.safe_mode=on#g"/lvtao.net/software/php/etc/php.ini


Sed-i "S#max_input_time = 60#max_input_time = 30#g"/lvtao.net/software/php/etc/php.ini


Sed-i "s#disable_functions = #disable_functions = Exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_ Multi_exec,parse_ini_file,show_source#g "/lvtao.net/software/php/etc/php.ini

Edit/lvtao.net/software/php/etc/php.ini Add the following at the bottom:

Zend_extension=/lvtao.net/software/php/lib/php/extensions/no-debug-zts-20121212/opcache.so
opcache.memory_consumption=128
Opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
Opcache.revalidate_freq=60
Opcache.fast_shutdown=1
Opcache.enable_cli=1

Vi/lvtao.net/software/php/etc/php-fpm.conf

Enter the following content

[WWW]
user = www
Group = www
Listen = 127.0.0.1:9000
#listen =/tmp/php-cgi.sock
PM = static
Pm.max_children = 35
Pm.max_requests = 256
Pm.process_idle_timeout = 30s
Rlimit_files = 65535
ENV[TMP] =/tmp/
Env[tmpdir] =/tmp/
Env[temp] =/tmp/
Php_admin_value[sendmail_path] =/usr/sbin/sendmail-t-i-f admin@bugxm.com
Php_admin_value[open_basedir] =/lvtao.net/htdocs/:/tmp/:/var/tmp:/proc/
Php_admin_value[session.save_path] =/tmp/
Php_admin_value[upload_tmp_dir] =/tmp/
Slowlog =/lvtao.net/software/php/var/log/$pool. log
Request_slowlog_timeout = 3s
Php_admin_value[open_basedir] =/lvtao.net/htdocs/:/tmp/:/var/tmp:/proc/

Add PHP-FPM to Service

cp/lvtao.net/resource/php-5.5.12/sapi/fpm/init.d.php-fpm/etc/rc.d/init.d/php-fpm
chmod +x/etc/rc.d/init.d/php-fpm
Service PHP-FPM Start

Open the necessary ports

/sbin/iptables-i input-p TCP--dport 80-j ACCEPT
/etc/rc.d/init.d/iptables Save

To set up the boot Autostart service

Vi/etc/rc.local
Ulimit-shn 65535
Service PHP-FPM Start
Service Nginx Start
Service mysqld Start

Configure maximum number of files, append at the bottom

Vi/etc/security/limits.conf
* Soft Nofile 65535
* Hard Nofile 65535

Related Article

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.