日期:2014-05-16 浏览次数:20936 次
服务器配置
型号:DELL 2650
CPU:Xeon 3.20GHz * 2
内存:4G DDR266
硬盘:SCSI 10Krpm 146G RAID 1
#author:wubolu
#date:20110413
#system:CentOS 5.6 i386
#mysql-5.5.11 + nginx-1.0.0 + php-5.3.6
自动校对时间
crontab -l
1 4 * * * ntpdate 210.72.145.44
安装前首先使用yum命令安装、升级所需的程序库
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers libxslt-devel libevent-dev ntp
------------------------------?? 安装 MySQL 部分??? ------------------------------
创建mysql用户
groupadd mysql
useradd -g mysql mysql
安装cmake
tar zxvf cmake-2.8.4.tar.gz
安装mysql
tar zxvf mysql-5.5.9.tar.gz
MY_dir="/usr/local/mysql"
cmake -DCMAKE_INSTALL_PREFIX="$MY_dir" -DDEFAULT_CHARSET=utf8? -DMYSQL_DATADIR="$MY_dir/"data/? -DCMAKE_INSTALL_PREFIX="$MY_dir" -DSYSCONFDIR="$MY_dir" -DDEFAULT_COLLATION=utf8_general_ci -DENABLE_DEBUG_SYNC=0 -DENABLED_LOCAL_INFILE=1 -DENABLED_PROFILING=1 -DWITH_READLINE=1 .
make
make install
./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
使用my-large.cnf模板
cp mysql/support-files/my-large.cnf ../my.cnf
添加慢查询日志及其他一些设置
[mysqld]
slow-query-log = 1
slow-query-log-file = /usr/local/mysql/data/slow.log
default-storage-engine = MyISAM
character-set-server = utf8?????? #如果不指定这个,程序连接可能导致乱码。查看mysql> show variables like '%character%'
wait_timeout = 300??????????????? #对当前连接有效。
interactive_timeout = 300???????? #对后续连接
修改权限
chown -R mysql:mysql /usr/local/mysql
------------------------------?? 安装 Nginx 部分??? ------------------------------
指定以后的HTTP文件目录
groupadd www
useradd -g www www
mkdir -p /usr/local/chong.com/
chmod +w /usr/local/chong.com/
chown -R www:www /usr/local/chong.com/
安装PCRE
[root@205053 tmp]# rpm -qa |grep pcre???? #查看自带的PCRE。
pcre-6.6-6.el5
[root@205053 tmp]# cp /lib/libpcre.so.0 /??? #备份libpcre.so.0,32位系统在lib下,64位系统在lib64下。
[root@205053 tmp]# rpm -e --nodeps pcre-6.6-6.el5???? #删除自带的PCRE。
[root@205053 tmp]# cp /libpcre.so.0 /lib???? #恢复libpcre.so.0到lib
开始安装
tar zxvf pcre-8.12.tar.gz
cd pcre-8.12
./configure
make && make install
安装Nginx
tar zxvf nginx-1.0.0.tar.gz
cd nginx-1.0.0
./configure --user=www --group=www --prefix=/usr/local/nginx
make && make install
#修改好配置文件,启动就可以访问到Welcome to nginx!
--NGINX:
user? www www;
worker_processes? 4;
error_log? logs/error.log;
pid??????? nginx.pid;
events {
??? worker_connections? 10240;
}
http {
??? include?????? mime.types;
??? default_type? application/octet-stream;
??? sendfile??????? on;
??? keepalive_timeout? 65;
??? server {
??????? listen?????? 80;
??????? server_name www.wubolutest.com;
??????? root??? /usr/local/chong.com;
??????? index? index.php index.html index.htm;
??????? access_log? off;
??????? error_page? 404????????????? /index.php;
??????? error_page?? 500 502 503 504? /50x.html;
?
??????? location ~* ^.+.(jpg|jpeg|gif|css|png|js|html|htm)$ {
????????????? expires?????????? 1d;
????????????? break;
??????? }
??????? location ~* ^/(images|javascript|js|css|flash|media|static)/ {
????????????? expires 1d;
??????? }
??????? location ~* ^.+.(php|php5)$ {
??????????? fastcgi_pass?? 127.0.0.1:9000;
??????????? fastcgi_index? index.php;
??????????? fastcgi_param? SCRIPT_FILENAME? /usr/local/chong.com/$fastcgi_script_name;
??????