Get the App
SLTechnology News&Howtos  ›  Development  › 

How to build VPS based on Nginx+PHP+MySQL

Shulou Source: shulou.com Published: 2022-06-01 03:45:21 09月22日 Update

This article mainly introduces the relevant knowledge of "how to build VPS based on Nginx+PHP+MySQL". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to build VPS based on Nginx+PHP+MySQL" can help you solve the problem.

At present, the worker_processes of nginx is set to 4Jing phpmurfpm and set to dynamic mode. In max_children=32,start_servers=8,min_spare_servers=4,max_spare_servers=16,max_request=512 environment, 540mb memory remains 380mb. Compared with the previous lamp memory overhead built with zend server ce, the optimization effect is still very obvious, and the website speed is also very ideal. What gives me the biggest feeling is that the response speed of the page request is greatly improved than before.

In view of the lack of relevant information on the Internet soon after the release of the new product mysql5.5.8, add some of my own compilation content (note that I have no need for innodb, so I block the innodb engine, if necessary, you can turn on the parameter-dwith_innobase_storage_engine=1.

The copy code is as follows:

# download software package

Wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz

Wget http://ftp.gnu.org/gnu/bison/bison-2.4.3.tar.gz

Tar zxvf cmake-2.8.3.tar.gz

Cd cmake-2.8.3/

. / configure-- prefix=/usr

Gmake

Gmake install

Cd.. /

Tar zxvf bison-2.4.3.tar.gz

Cd cd bison-2.4.3

. / configure

Make

Make install

# install mysql5.5.8

/ usr/sbin/groupadd mysql

/ usr/sbin/useradd-g mysql mysql

Mkdir-p / data/mysql

Chown-r mysql:mysql / data/mysql

Tar zxvf mysql-5.5.8.tar.gz

Cd mysql-5.5.8

Cmake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/data/mysql-dwithout_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_myisam_storage_engine=1-dsysconfdir=/etc/-dwith_ssl=yes-ddefault_charset=utf8-ddefault_collation=utf8_general_ci-dwith_readline=on

Make

Make install

/ usr/local/mysql/scripts/mysql_install_db-basedir=/usr/local/mysql/-datadir=/data/mysql-user=mysql

# modify mysql config

Vim / etc/my.cnf

[client]

Port = 3306

Socket = / tmp/mysql.sock

[mysqld]

Port = 3306

Socket = / tmp/mysql.sock

Skip-external-locking

Key_buffer_size = 256m

Max_allowed_packet = 1m

Table_open_cache = 256

Sort_buffer_size = 1m

Read_buffer_size = 1m

Read_rnd_buffer_size = 4m

Myisam_sort_buffer_size = 64m

Thread_cache_size = 8

Query_cache_size= 16m

Thread_concurrency = 1

Basedir = / usr/local/mysql

Datadir = / data/mysql

Default-storage-engine = myisam

Log-bin=mysql-bin

Binlog_format=mixed

Server-id = 1

[mysqldump]

Quick

Max_allowed_packet = 16m

[mysql]

No-auto-rehash

[myisamchk]

Key_buffer_size = 128m

Sort_buffer_size = 128m

Read_buffer = 2m

Write_buffer = 2m

[mysqlhotcopy]

Interactive-timeout

# add to boot config

Cp / usr/local/mysql/support-files/mysql.server / etc/rc.d/init.d/mysqld

Chkconfig-add mysqld

/ etc/rc.d/init.d/mysqld start

/ usr/local/mysql/bin/mysql-u root-p-s / tmp/mysql.sock

Ps: if you report an error error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: no such file or directory when compiling php, you can solve it by the following methods:

The copy code is as follows:

Ln-s / usr/local/mysql/lib/mysql/libmysqlclient.so.16 / usr/lib/libmysqlclient.so.16

This is the end of the introduction to "how to build VPS based on Nginx+PHP+MySQL". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Code knowledge memory content method industry speed compilation different practical obvious maximum parameter can pass practical practical that is overhead engine effect Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Docker Apple MySQL vpn