1024programmer Nginx How to install tengine+php-fpm+mariadb on CentOS6.4

How to install tengine+php-fpm+mariadb on CentOS6.4

The new machine 67 of the school’s BBS is mainly used as a reverse proxy to 216 to speed up access to the external network. Because the school has accelerated deployment of telecommunications for the network segment where 67 is located, access to the external network is very slow. quick. (Here 67 and 216 are the last segment of the machine IP, and the complete IP is omitted here)

The new machine configuration is not bad, 4G memory and 16-core CPU (hey… why are there so many CPUs, I only needed 8 cores when I applied for it.), post it to show off…

[oott123@FastBird ~]$ free -m
total used free free shared buffers cached
Mem: 3830 1117 2713 0 67 745
-/+ buffers/cache: 304 3526
Swap: 3967 0 3967
[oott123@FastBird ~]$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz
stepping : 7
cpu MHz : 2000.000
cache size : 20480 KB

The parameters will not leak too much… In short, the virtualization technology used is actually VMWare (caused by the majority of the school’s Win platform). Because it is a production environment, the tragic point is that you cannot actively connect to the external network, and the external listening port is only open to 80, and ssh and the like can only be accessed through a VPN. This time, considering that the server conditions are good, and there are certain requirements for speed, I plan to use Tengine as a reverse proxy for dynamic and static separation. Obviously this server is responsible for static acceleration, so why install MariaDB and php-fpm?

Hmm… the answer is that my idle eggs hurt (fog). [Actually, there are some special needs that are hard to say too much.

Well, that’s about it, let’s organize my TMP installation process. Since it is a school machine, I asked the teacher in the information center to install CentOS 6.4. After getting it, I found out that it is the full version with all kinds of software packages… First, I uninstalled mysql which was in the way.

yum remove mysql mysql-*

The reason why it must be uninstalled is that this product will conflict with MariaDB… The next installation sequence is Tengine->MariaDB->php-fpm

Tegine is compiled and installed, and the source package and jmalloc are downloaded from the official website and SFTPed to the server. Execute the compilation of Tegine with jmalloc as follows:

yum install pcre-devel #This is the pcre package, which is used for rewrite.
./configure –user=apache –group=apache –with-http_stub_status_module –with-http_gzip_static_module –with-http_sysguard_module –with-http_concat_module –with-jemalloc=../jemalloc-3.4.0
make && make install

There is no need for too many modules, because Tegine supports DSO dynamic module loading, and modules to be added later can be added separately. Besides, the server didn’t even open port 443, and ipv6 couldn’t be deployed because it was a new computer room, so ipv6 and ssl weren’t brought in either. Since the webpage files on 216 are all owned by apache/apache, so here is also the same for apache. This machine is very cool to compile, and it is completed in less than 1 minute.

Then I downloaded the init.d of other people’s nginx from the Internet and copied it to the corresponding directory… I won’t talk about this process without covering my face…

Next is MariaDB, using the 5.5 stable version. According to the official installation guide, if I want the rpm package, I have to configure his yum source. Unfortunately, 67 cannot access the external network, so I have to download these files manually:

http://yum.mariadb.org/5.5/centos6-amd64/rpms/MariaDB-5.5.31-centos6-x86_64-compat.rpm
http://yum.mariadb.org/5.5/centos6-amd64/rpms/MariaDB-5.5.31-centos6-x86_64-common.rpm
http://yum.mariadb.org/5.5/centos6-amd64/rpms/MariaDB-5.5.31-centos6-x86_64-shared.rpm
http://yum.mariadb.org/5.5/centos6-amd64/rpms/MariaDB-5.5.31-centos6-x86_64-server.rpm
http://yum.mariadb.org/5.5/centos6-amd64/rpms/MariaDB-5.5.31-centos6-x86_64-client.rpm

The address given is the download address of centos6, x64, and Maria5.5, so don’t take it easy. After downloading, install it in the order above:

rpm -ivh MariaDB-5.5.31-centos6-x86_64-compat.rpm
rpm -ivh MariaDB-5.5.31-centos6-x86_64-common.rpm
rpm -ivh MariaDB-5.5.31-centos6-x86_64-shared.rpm
rpm -ivh MariaDB-5.5.31-centos6-x86_64-server.rpm
rpm -ivh MariaDB-5.5.31-centos6-x86_64-client.rpm #Optional, provide mysql command

The order must be correct… first compat, then common, then shared, and finally server. If you follow the official one, it’s easy to handle. After setting it up, yum will automatically handle the dependencies.

Remember to perform security initialization after installing MariaDB:

service mysqld restart #Open MariaDB
/usr/bin/mysql_secure_installation

Then the wizard will guide you to set the root password, prohibit empty user connections, etc.

The last is the installation of php-fpm. First look at which version of the built-in php is:

[oott123@FastBird ~]$ php -v
PHP 5.3.3 (cli) (built: Feb 22 2013 02:51:11)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Well, it’s 5.3.3 directly. That’s easy, just install php-fpm directly with yum install php-fpm.

There is also linking php-fpm and tegine. I let php-fpm listen to unix socks, as follows:

vim /etc/php-fpm.d/www.conf
#Modification: listen = /tmp/php-cgi.sock
vim /usr/local/nginx/conf/fastcgi_params
#Document full text
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
vim /usr/local/nginx/conf/nginx.conf
#location configuration of the server field
Location ~ .*\.(php|php5)?$ {
Fastcgi_pass unix:/tmp/php-cgi.sock;
Fastcgi_index index.php;
include fastcgi_params;
}

The last step is to set up each software to start automatically:

chkconfig mysqld on
chkconfig php-fpm on
vim /etc/rc.local #Add a line /etc/init.d/nginx start to start Tegine

finished.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-to-install-tenginephp-fpmmariadb-on-centos6-4/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索