源码编译方式安装NGINX PHP
1 2 3 4 5 |
echo "[dag]" > /etc/yum.repos.d/dag.repo echo "name=Dag RPM Repository for Red Hat Enterprise Linux" >> /etc/yum.repos.d/dag.repo echo "baseurl=http://apt.sw.be/redhat/el\$releasever/en/\$basearch/dag" >> /etc/yum.repos.d/dag.repo echo "gpgcheck=0" >> /etc/yum.repos.d/dag.repo echo "enabled=1" >> /etc/yum.repos.d/dag.repo |
安装基础环境以及依赖包
1 2 3 4 |
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 yum install subversion -y yum install mcrypt libmcrypt libmcrypt-devel mhash mhash-devel pcre pcre-devel |
下载安装包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
http://de.php.net/get/php-5.3.16.tar.gz/from/us.php.net/mirror http://no2.php.net/get/php-5.4.6.tar.gz/from/us.php.net/mirror tar xvfz php-5.4.6.tar.gz // tar -jxvf php-5.4.6.tar.bz2 cd php* ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysqld --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --with-mysqli=/usr/local/mysqld/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-libxml-dir=/usr --enable-xml --with-mhash --with-mcrypt --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/etc --with-bz2 --with-curl make make install cp php.ini-production /usr/local/php/etc/php.ini cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm chmod +x /etc/rc.d/init.d/php-fpm cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf vim /usr/local/php/etc/php-fpm.conf pid = run/php-fpm.pid pm.max_children = 50 最多多少子进程 pm.start_servers = 5 刚开始启动多少进程 pm.min_spare_servers = 2 最少多少空闲进程 pm.max_spare_servers = 8 最多多少空闲进程 service php-fpm start http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz yum install subversion -y cd php-5.3.x svn co http://svn.php.net/repository/php/php-src/trunk/sapi/fpm sapi/fpm ./buildconf --force ./configure --enable-fpm ...your other configure options, etc... make && make install http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.27.tar.gz/from/http://cdn.mysql.com/ /usr/sbin/groupadd -r mysql /usr/sbin/useradd -g mysql mysql useradd -g mysql -r -s /sbin/nologin tar zxvf mysql-5.5.27.tar.gz cd mysql-*/ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysqld -DINSTALL_DATADIR=/usr/local/mysqld/database -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 make make install ./configure --prefix=/usr/local/mysqld/ --enable-assembler --with-extra-charsets=complex --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase,myisammrg make && make install chmod +w /usr/local/mysqld chown -R mysql:mysql /usr/local/mysqld scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysqld/data default-storage-engine=MyISAM export PATH=/usr/local/mysqld/bin/:$PATH echo '/usr/local/mysqld/lib/' > /etc/ld.so.conf ldconfig bin/mysqladmin -u root password '111000' |
NGINX 安装
1 2 3 4 5 6 7 8 |
wget -c http://nginx.org/download/nginx-1.2.3.tar.gz groupadd -r nginx useradd -r -g nginx -s /sbin/nologin -M nginx tar xf nginx-*.tar.gz cd nginx-* ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/etc/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --user=nginx --group=nginx --with-http_ssl_module --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client/ --http-proxy-temp-path=/var/tmp/nginx/proxy/ --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi --with-pcre make && make install |