---------------- 把源码包放在/usr/local/tar/目录下---------------------------------------------------------------------------
---------centos 是用yum安装 ,suse 是用yast --install 安装
yum -y install gcc
yum -y install gcc-c++
yum -y install ncurses-devel
yum -y install make
yum -y install gettext-devel
yum -y install pcre-devel openssl-devel
yum -y install curl-devel
yum -y install libxml2 libxml2-devel
yum -y install patch
cd /usr/local/tar/
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6/
./configure --with-shareed --without-debug --without-ada --enable-overwrite
make
make install
cd ..
tar zxvf mysql-5.0.41.tar.gz
cd mysql-5.0.41/
mkdir -p /data/data1/mysql
mkdir -p /data/tmp/
./configure --prefix=/data/mysql --with-plugins=all --with-mysqld-user=mysql --with-charset=utf8 --with-extra-charsets=all -with-unix-socket-path=/data/tmp/mysql.sock --localstatedir=/data/data1/mysql/ --enable-assembler --sysconfdir=/etc --enable-thread-safe-client --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static-ltinfo
make
make install
groupadd mysql
useradd -g mysql mysql
cp -f support-files/my-medium.cnf /etc/my.cnf
cd /data/mysql
chown -R root .
chgrp -R mysql .
cd /usr/local/tar/
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5/
./configure --prefix=/data/freetype
make
make install
cd ..
tar zxvf libpng-1.2.33.tar.gz
cd libpng-1.2.33/
cp scripts/makefile.linux makefile
make test
make install
cd ..
tar zxvf jpegsrc.v8a.tar.gz
cd jpeg-8a/
mkdir /data/jpeg
mkdir /data/jpeg/bin
mkdir /data/jpeg/lib
mkdir /data/jpeg/include
mkdir /data/jpeg/man
mkdir /data/jpeg/man/man1
./configure --prefix=/data/jpeg --enable-shared --enable-static
make
make install
cd ..
tar zxvf gd-2.0.35.tar.gz
cd gd-2.0.35/
./configure --prefix=/data/gd --with-jpeg=/data/jpeg --with-png=/data/libpng --with-zlib=/data/zlib --with-freetype=/data/freetype
make
make install
cd ..
tar zxvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable/
./configure && make && make install
cd ..
tar zxvf zlib-1.2.3.tar.tar
cd zlib-1.2.3/
CFLAGS="-O3 -fPIC" ./configure && make && make install
cd ..
tar zxvf php-5.2.6.tar.gz
gzip -cd php-5.2.6-fpm-0.5.9.diff.gz | patch -d php-5.2.6 -p1
cd php-5.2.6/
ln -s /data/mysql/bin/mysql_config /usr/bin/mysql_config
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
-fno-exceptions -fno-rtti" ./configure --prefix=/data/php --with-zlib --enable-pdo=shared --with-pdo-sqlite=shared --with-sqlite=shared --with-pdo-mysql=shared --with-gd=/data/gd --enable-gd --enable-gd-native-ttf --with-jpeg-dir=/data/jpeg --with-png --with-ttf --with-freetype-dir=/data/freetype --enable-magic-quotes --with-mysql=/data/mysql --with-mysql-sock=/data/tmp/mysql.sock --with-iconv --with-mbstring --enable-mbstring --enable-track-vars --with-config-file-path=/etc --with-pear=/data/pear --with-curl=/data/curl/ --with-curlwrappers --enable-fastcgi --enable-force-cgi-redirect --enable-fastcgi --enable-fpm
make
make install
cp php.ini-dist /etc/php.ini
echo "/data/php/sbin/php-fpm start" >>/etc/rc.local
cd ..
tar zxvf memcache-2.2.5.tgz
tar zxvf memcached-1.4.4.tar.gz
cd memcached-1.4.4
./configure && make && make install
cd ..
cd memcache-2.2.5
/data/php/bin/phpize
./configure --with-php-config=/data/php/bin/php-config
make && make install
cd ..
tar zxvf libxml2-2.7.6.tar.gz
cd libxml2-2.7.6/
./configure && make && make install
cd ..
tar zxvf amfext-0.9.2.tgz
cd amfext-0.9.2
/data/php/bin/phpize
./configure --with-php-config=/data/php/bin/php-config
make && make install
cd ..
tar jxvf eaccelerator-0.9.6.tar.bz2
cd eaccelerator-0.9.6
/data/php/bin/phpize
./configure --with-php-config=/data/php/bin/php-config
make && make install
cd ..
tar zxvf gamin-0.1.10.tar.gz
cd gamin-0.1.10
./configure && make && make install
cd ..
tar zxvf pcre-8.01.tar.gz
cd pcre-8.01
./configure && make && make install
cd ..
tar zxvf PDO-1.0.3.tgz
cd PDO-1.0.3
/data/php/bin/phpize
./configure --with-php-config=/data/php/bin/php-config && make && make install
cd ..
tar zxvf PDO_MYSQL-1.0.2.tgz
cd PDO_MYSQL-1.0.2
/data/php/bin/phpize
./configure --with-php-config=/data/php/bin/php-config && make && make install
cd ..
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6/
./configure && make && make install
cd ..
tar -zxvf openssl-0.9.8k.tar.gz
cd openssl-0.9.8k
./configure --prefix=/data/openssl
make
make install
cd ..
tar zxvf nginx-0.8.54.tar.gz
cd nginx-0.8.54/
./configure --prefix=/data/nginx/ --with-http_stub_status_module --with-openssl=/usr/local/openssl
make && make install
/data/nginx/sbin/nginx
echo "/data/nginx/sbin/nginx" >>/etc/rc.local
cd ..
tar zxvf mongodb-linux-x86_64-static-legacy-2.2.2.tgz
mv mongodb-linux-x86_64-static-legacy-2.2.2 /data/ssd/mongodb
cd /data/ssd/mongodb/
mkdir DataDB
mkdir Logs
mkdir LogDB
cd /usr/local/tar
tar zxvf mongodb-mongo-php-driver-1.3.0RC1-0-g360a7bf.tar.gz
cd mongodb-mongo-php-driver-360a7bf/
/data/php/bin/phpize
./configure --with-php-config=/data/php/bin/php-config --enable-mongo
./configure --with-php-config=/data/php/bin/php-config
make
cp modules/mongo.so /data/php/lib/php/extensions/no-debug-non-zts-20060613/
cd ..
tar zxvf ncurses-5.6.tar.gz
cd ncurses-5.6/
./configure
make
make install clean
cd ..
tar -xzf otp_src_R16B.tar.gz
cd otp_src_R16B/
./configure
make
make install
cd ..
tar zxvf crypto-2.0.tar.gz -C /usr/local/lib/erlang/lib/
#/usr/local/mongodb/bin/mongod --dbpath /usr/local/mongodb/DataDB/ --port 27017 --logpath /usr/local/mongodb/Logs/logs --logappend
echo "/data/rysj/mongodb/bin/mongod --dbpath /data/rysj/mongodb/DataDB/ --port 27017 --logpath /data/rysj/mongodb/Logs/logs1.txt --logappend --fork" >>/etc/rc.local
echo "/data/rysj/mongodb/bin/mongod --dbpath /data/rysj/mongodb/LogDB/ --port 27217 --logpath /data/rysj/mongodb/Logs/logs2.txt --logappend --fork" >>/etc/rc.local
--------------------------------------------------配置-----------------------------------------
一、配置/etc/php.ini 找到;extension=php_zip.dll 后添加
extension_dir="/data/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension="memcache.so"
extension="mongo.so"
二、配置PHP
进入/data/php/etc/下
cp php-fpm.conf php-fpm-web.conf
vi php-fpm-web.conf
找到
<value name="php_defines">后添加
<value name="open_basedir">/data/ssd/server:/data/ssd/www/html:/data/ssd/www/php</value>
找到
Unix user of processes
<-- <value name="user">nobody</value> -->
Unix group of processes
<-- <value name="group">nobody</value> -->
把<-- -->去掉
在cp php-fpm-web.conf php-fpm-server.conf
vi php-fpm-server.conf
找到<value name="listen_address">127.0.0.1:9000</value> 把9000修改9001 #注意9000 与9001端口是用来与ngnix相连的
进入/data/php/sbin/下
vi php-fpm
找到case "$1" in
start)
echo -n "Starting php_fpm "
# $php_fpm_BIN --fpm $php_opts 这里用#注释掉后下面添加
$php_fpm_BIN --fpm --fpm-config /data/php/etc/php-fpm-web.conf
$php_fpm_BIN --fpm --fpm-config /data/php/etc/php-fpm-server.conf
三、配置nginx
进入/data/nginx/conf/下
mv nginx.conf nginx.conf.bak
vi nginx.conf
把已经优化过的配置nginx.conf内容复制进去。也可以看以前的nginx.conf配置
复制后,我们来修改以下的
server
{
listen 80;
server_name s1.com; #修改域名
index index.html index.htm index.php;
root /data/ssd/www/html; #WEB代码放的目录。
#limit_conn crawler 20;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000; #这里与php-fpm-web.conf的9000端口对应
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/ssd/www/html$fastcgi_script_name; #WEB代码放的目录。
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
}
}
server
{
listen 81;
server_name s1.com; #修改域名
index index.html index.htm index.php;
root /data/ssd/server; #DB代码放的目录。我们可以把rockmongo放在这里,就可以从81端口进入了。
#limit_conn crawler 20;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9001; #这里与php-fpm-server.conf的9001端口对应
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/ssd/server$fastcgi_script_name; #DB代码放的目录
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
}
}
-------------------------------
/data/php/sbin/php-fpm start 开启php restart重启
/data/ngnix/sbin/nginx 开启nginx /data/ngnix/sbin/nginx -s reload
-------------------------------------------为止-----------------------------------------------------------------------------------------
--------------------------一个WEB多个DB--------------------------------------------------------------------------------
一、配置PHP
一、配置/etc/php.ini 找到;extension=php_zip.dll 后添加
extension_dir="/data/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension="memcache.so"
extension="mongo.so"
二、配置PHP
进入/data/php/etc/下
cp php-fpm.conf php-fpm-web.conf
vi php-fpm-web.conf
找到
<value name="php_defines">后添加
<value name="open_basedir">/data/ssd/server:/data/ssd/www/html:/data/ssd/www/php</value>
找到
Unix user of processes
<-- <value name="user">nobody</value> -->
Unix group of processes
<-- <value name="group">nobody</value> -->
把<-- -->去掉
在cp php-fpm-web.conf php-fpm-server.conf
vi php-fpm-server.conf
找到<value name="listen_address">127.0.0.1:9000</value> 把9000修改9001 #注意9000 与9001端口是用来与ngnix相连的
-------------------如果配置一个WEB多个DB只是多加个端口。
cp php-fpm-web.conf php-fpm-web2.conf
vi php-fpm-web2.conf
找到<value name="listen_address">127.0.0.1:9002</value> 把9000修改9002
找到
<value name="php_defines">后修改
<value name="open_basedir">/data/ssd/server:/data/ssd/www2/html:/data/ssd/www2/php</value>
-----------------------------------------------------------------------
进入/data/php/sbin/下
vi php-fpm
找到case "$1" in
start)
echo -n "Starting php_fpm "
# $php_fpm_BIN --fpm $php_opts 这里用#注释掉后下面添加
$php_fpm_BIN --fpm --fpm-config /data/php/etc/php-fpm-web.conf
$php_fpm_BIN --fpm --fpm-config /data/php/etc/php-fpm-server.conf
$php_fpm_BIN --fpm --fpm-config /data/php/etc/php-fpm-web2.conf
二、配置nginx
进入/data/nginx/conf/下
vi nginx.conf
找到http{ }里面 加入
include web.conf
include web2.conf
把里面
server{
listen 80
...........
}
删除。
保存退出
vi web.conf 内容
server
{
listen 80;
server_name s1.com;
index index.html index.htm index.php;
root /data/ssd/www/html;
#limit_conn crawler 20;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/ssd/www/html$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
}
}
vi web2.conf
server
{
listen 80;
server_name s2.com; #域名
index index.html index.htm index.php;
root /data/ssd/www2/html; #目录
#limit_conn crawler 20;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9002; #端口
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/ssd/www2/html$fastcgi_script_name; #目录
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
{
expires 30d;
}
}
我们就可以重启nginx与php
-----------------------------------------------------------------------------------------------------------------------