Powered by Typecho)))
Optimized by EAimTY
Nginx+Apache(suexec+fcgid)+PHP5.3.x+Mysql5.1.x+Pureftpd+Quota服务器部署笔记
首选32bit centos
源码包全部放在/usr/src/source_package下
1:初始化环境
#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 mhash mhash-devel libmcrypt libmcrypt-devel libc-client libc-client-devel
2:安装libevent
#wget http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz#tar xf libevent-1.4.14b-stable.tar.gz#cd libevent-1.4.14b-stable #./configure --enable-shared#make && make install
3:安装pcre
#wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz#tar xf pcre-8.10.tar.gz#cd pcre-8.10/#./configure --enable-shared --enable-utf8 --enable-unicode-properties#make && make install
4:安装libunwind
#wget http://download.savannah.gnu.org/releases/libunwind/libunwind-0.99.tar.gz#tar xf libunwind-0.99.tar.gz#cd libunwind-0.99#./configure --enable-shared#make && make install
5:安装google-perftools
#wget http://google-perftools.googlecode.com/files/google-perftools-1.6.tar.gz#tar xf google-perftools-1.6.tar.gz#cd google-perftools-1.6#./configure --enable-shared##注:64bit 必须加上--enable-frame-pointers#make && make install
6:安装nginx.
#wget http://labs.frickle.com/files/ngx_cache_purge-1.0.tar.gz#tar zxvf ngx_cache_purge-1.0.tar.gz#wget http://nginx.org/download/nginx-0.8.50.tar.gz#tar zxvf nginx-0.8.50.tar.gz#cd nginx-0.8.50/#cd ../#useradd -d /dev/null -s /sbin/nologin -c "Nginx Runner" -r www-data#mkdir -p /zh/nginx#mkdir -p /tmp/nginx/client/cache#mkdir -p /tmp/nginx/proxy/cache#mkdir -p /tmp/nginx/fastcgi/cache
如想提速,可以将缓存目录划到/dev/shm下
#./configure --prefix=/zh/nginx --user=www-data --group=www-data --with-rtsig_module --with-select_module --with-poll_module --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_sub_module --with-http_flv_module --with-http_gzip_static_module -–with-file-aio --with-http_stub_status_module --http-client-body-temp-path=/tmp/nginx/client --http-proxy-temp-path=/tmp/nginx/proxy --http-fastcgi-temp-path=/tmp/nginx/fastcgi --with-google_perftools_module --add-module=/usr/src/source_package/ngx_cache_purge-1.0#make && make install
如需要无缝升级:
#cp -r --force objs/nginx /zh/nginx/sbin#/etc/init.d/nginx restart
7:Mysql5.1、PHP5.3.x安装编译mysql
#./configure --prefix=/usr/local/mysqld --enable-assembler --with-charset=utf8 --with-extra-charsets=all --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=max-no-ndb --enable-shared --with-tcp-port=3306 --with-mysqld-user=mysqld --with-low-memory --with-mysqlmanager
安装并初始化环境
# make # make install# cp support-files/my-medium.cnf /usr/local/mysqld/etc/my.cnf
更改目录权限
# chown -R mysqld /usr/local/mysqld # chown -R mysqld /var/mysqldata # chown -R mysqld:mysqld /usr/local/mysqld # chown -R mysqld:mysqld /var/mysqldata # chmod 711 /usr/local/mysqld -R# chmod 755 /usr/local/mysqld/lib/ -R# chmod 700 /var/mysqldata -R
初始化数据库
# /usr/local/mysqld/bin/mysql_install_db --user=mysqld --datadir=/var/mysqldata --basedir=/usr/local/mysqld --skip-name-resolve --defaults-file=/usr/local/mysqld/etc/my.cnf
php编译:
#./configure --prefix=/zh/php5 --enable--mod-charset --enable-roxen-zts --with-libxml-dir=/usr --with-layout=GUN --with-config-file-path=/zh/php5/etc --with-config-file-scan-dir=/home/*/etc --with-openssl --with-zlib --enable-sigchild --enable-bcmath --enable-calendar --with-curl --with-curlwrappers --enable-exif --enable-ftp --disable-rpath --with-gd --with-jpeg-dir --with-png-dir --enable-gd-native-ttf --with-gettext --with-mhash --with-imagick --with-imap --with-imap-ssl --enable-mbstring --with-mcrypt --with-mysql=mysqlnd --enable-mbregex --with-mysql-sock --with-mysqli --with-pdo-mysql --with-pdo-sqlite --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-sysvsem --with-xmlrpc --enable-zip --without-pear --enable-shmop --enable-pcntl --with-libevent=shared --with-kerberos --enable-phar --enable-session --enable-simplexml --enable-snmp --enable-sqlite3 --enable-tidy --enable-tokenizer --enable-xml --enable-xmlreader --enable-xmlrpc --enable-xmlwriter --enable-xsl --enable-fastcgi --enable-cgi --enable-shared#make#make install
安装eAccelerator、Memcache、suhosin扩展:
1:memcache#/zh/php5/bin/phpize#./configure --with-php-config=/zh/php5/bin/php-config --enable-shared --enable-memcache#make && make install2:eaccelerator#/zh/php5/bin/phpize#./configure --with-php-config=/zh/php5/bin/php-config --enable-shared --enable-eaccelerator --with-gnu-ld#make && make install3:suhosin#/zh/php5/bin/phpize#./configure --with-php-config=/zh/php5/bin/php-config --enable-shared --enable-suhosin#make && make install
添加至php.ini
5:Apache(suexec+mod_fcgid)安装
http://blog.37hi.com/archives/229/
http://blog.37hi.com/archives/221/
6:为Apache安装mod_rpaf模块获取真实IP
tar -xf mod_rpaf-0.6.tar.gzcd mod_rpaf-0.6/usr/local/apache2/bin/apxs -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
编辑httpd.conf文件添加:
#rpaf_moduleLoadModule rpaf_module modules/mod_rpaf-2.0.so#Mod_rpaf settingsRPAFenable OnRPAFproxy_ips 127.0.0.1 [your_ips]RPAFsethostname OnRPAFheader X-Forwarded-For#rpaf_module end
[your_ips]请修改为你本机所监听web服务的ip.多个IP用空格空开.
7:pureftpd安装。
8:简单优化
9:编写web控制端。