基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS
更新时间:2010年12月28日 14:16:04 作者:
经过几个小时的编译安装配置,基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP稳定版架构搭建的VPS终于稳定运行。
虽然开始在MySQL5.5.8的编译过程中遇到了一些问题,因为之前从未接触过Cmake方式的编译,在查阅官方手册并结合谷歌,终于把问题搞定了。
目前Nginx的worker_processes设置为4,php-fpm设置为dynamic模式,max_children=32,start_servers=8,min_spare_servers=4,max_spare_servers=16,max_request=512的环境下,540MB内存剩余380MB,相比之前用Zend Server CE搭建的LAMP内存开销,优化效果还是十分明显的,而且网站速度也很理想,给我最大的感受就是页面请求的响应速度比以前大大提升了。
鉴于MySQL5.5.8这个新产品发布不久,网上的相关资料匮乏,补充一些自己在编译上的内容(注意,我因为自己对innodb无需求,因此屏蔽了innodb引擎,如果需要可以开启参数-DWITH_INNOBASE_STORAGE_ENGINE=1。
#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:如果在编译PHP的时候报错error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory,可以通过以下方法解决:
ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
目前Nginx的worker_processes设置为4,php-fpm设置为dynamic模式,max_children=32,start_servers=8,min_spare_servers=4,max_spare_servers=16,max_request=512的环境下,540MB内存剩余380MB,相比之前用Zend Server CE搭建的LAMP内存开销,优化效果还是十分明显的,而且网站速度也很理想,给我最大的感受就是页面请求的响应速度比以前大大提升了。
鉴于MySQL5.5.8这个新产品发布不久,网上的相关资料匮乏,补充一些自己在编译上的内容(注意,我因为自己对innodb无需求,因此屏蔽了innodb引擎,如果需要可以开启参数-DWITH_INNOBASE_STORAGE_ENGINE=1。
复制代码 代码如下:
#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:如果在编译PHP的时候报错error while loading shared libraries: libmysqlclient.so.16: cannot open shared object file: No such file or directory,可以通过以下方法解决:
复制代码 代码如下:
ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
相关文章
linux系统报xfs_vm_releasepage警告问题的处理方法
这篇文章主要给大家介绍了关于linux系统报xfs_vm_releasepage警告问题的处理方法,文中通过示例代码介绍的非常详细,对大家学习或者使用linux系统具有一定的参考学习价值,需要的朋友们下面来一起学习学习吧2019-07-07解决Nginx + PHP(FastCGI)遇到的502 Bad Gateway错误
昨日,有朋友问我,他将Web服务器换成Nginx 0.6.31 + PHP 4.4.7(FastCGI)后,有时候访问会出现“502 Bad Gateway”错误,如何解决。2008-12-12Ubuntu 14.04下Django和MySQL环境部署全过程
这篇文章主要介绍了Ubuntu 14.04下Django和MySQL环境部署全过程,文中通过一步步的安装步骤介绍的很详细,相信对大家具有一定的参考借鉴价值,有需要的朋友们下面来一起来看看吧。2017-02-02详解CentOS7安装配置Apache HTTP Server
本篇文章主要介绍了CentOS7安装配置Apache HTTP Server,具有一定的参考价值,有兴趣的可以了解一下。2017-01-01
最新评论