本文共 7807 字,大约阅读时间需要 26 分钟。
CentOS release 6.5 (Final)x86_64
lamp
apache
wget tar cd ./configure --prifix=/application/apache2.2.27 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewriteyum install -y zlib-develmake && make install ln -s /application/apache2.2.27/ /application/apachell /application/apache/conf/httpd.conf/application/apache/bin/apachectl -t /application/apache/bin/apachectl gracefulps -ef|grep httpdmqsql
wget tar cd ./configure --prefix=/application/mysql5.1.68/ --with-unix-socket-path=/application/mysql5.1.68/tmp/mysql.sock --localstatedir=/application/mysql5.1.68/data --enable-assembler --enable-thread-safe-client --with-mysqld-user=mysql --with-big-tables --without-debug --with-pthread --enable-assembler --with-extra-charsets=complex --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=partition,innobase --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-plugin-PLUGIN echo $?yum install -y ncurses-develmake && make install /home/oldboy/mysql-5.1.68/support-files/my-small.cnf /etc/my.cnf/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql/home/oldboy/mysql-5.1.68/support-files/mysql.server /etc/init.d/mysqld登陆mysql测试php
1.php依赖包yum install -y zlib libxml libpng libjpeg freetype gd curl libiconv zlib-devel libxml2-devel libpng-devel libjpeg-devel freetype-devel gd-devel curl-devel libcronv-devel openssl-devel libcurl-devel libxslt-devel2.php包tar xf php-5.3.27.tar.gzcd php-5.3.27./configure --prefix=/application/php5.3.27 --with-apxs2=/application/apache/bin/apxs --with-mysql=/application/mysql --with-xmlrpc --with-openssl --with-zib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir --with-iconv=/usr/local/libiconv --enable-short-tags --enable-sockets --enable-zend-multibyte --enable-soap --enable-mbstring --enable-gd-native-ttf --with-curl --with-xsl --enable-ftp --with-libxml-dirmake make installln -s /application/php5.3.27 /application/phpcp php.ini-production /application/php/lib/php.ini/application/apache/conf/httpd.conf 修改apache的·LoadModule php5_module modules/libphp5.so·User www·Group www·ServerName 127.0.0.1:80·DirectoryIndex index.php index.htmluseradd -M -s /sbin/nologin www/application/apache/bin/apachectl graceful测试浏览器--index.html>>apache--index.php>>php--php脚本>>mysqlphp脚本内容
<?php$link_id=mysql_connect('localhost','root','123456') or mysql_error();if ($link_id) { echo "php-->mysqk successful"; }else{ echo "php ->mysql error()"; }
?>
lnmp
安装nginx
wget tar zxvf nginx-1.6.2.tar.gzcd nginx-1.6.2useradd -M -s /sbin/nologin nginxyum install gcc pcre-devel openssl-devel -y./configure --user=nginx --group=nginx --prefix=/application/nginx1.6.2 --with-http_stub_status_module --with-http_ssl_modulemake make install/application/nginx1.6.2/sbin/nginx -t/application/nginx1.6.2/sbin/nginxps -ef |grep nginx注意防火墙用二进制文件装mysql
wget --no-check-certificatetar -zxvf mysql-5.5.32-linux2.6-x86_64.tar.gzmv mysql-5.5.32-linux2.6-x86_64 /application/mysqlcp my-small.cnf /etc/my.cnfuseradd -M -s /sbin/nologin mysql./mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/datacp support-files/mysql.server /etc/init.d/mysqld修改/etc/init.d/mysqld里的basedir 和datadir/etc/init.d/mysqld start测试/application/mysql/bin/mysqlexport PATH=$PATT:/application/mysql/bin/mysqlphp
php依赖包yum install -y zlib libxml libpng libjpeg freetype gd curl libiconv zlib-devel libxml2-devel libpng-devel libjpeg-devel freetype-devel gd-devel curl-devel libcronv-devel openssl-devel libcurl-devel libxslt-devel gcc gcc-c++ libxsltwget tar -zxvf libiconv-1.14.tar.gzcd libiconv-1.14./configure --prefix=/usr/local/libiconvmake && make installwget --no-check-certificatetar -zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configure makemake install sleep 2/sbin/ldconfigcd libltdl/./configure --enable-ltdl-installmake && make installwget --no-check-certificatetar -zxvf mhash-0.9.9.9.tar.gzcd mhash-0.9.9.9./configuremake && make install rm -f /usr/lib64/libmhash.rm -f /usr/lib64/libmcrypt.*ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.laln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.soln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.aln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.laln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.soln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1ln -s /usr/local/lib64/libmcrypt-config /usr/lib64/libmcrypt-configwget --no-check-certificatetar -zxvf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8/sbin/ldconfig./configure LD_LIBRARY_PATH=/usr/local/libmakemake installphp安装
wget tar -zxvf php-5.3.27.tar.gzcd php-5.3.27./configure --prefix=/application/php5.3.27 --with-mysql=/application/mysql --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-zend-multibyte --enable-static --with-xsl --with-fpm-user=nginx --with-fpm-group=nginx --enable-ftpln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64makemake installln -s /application/php5.3.27/ /application/phpcp php.ini-production /application/php/lib/php.inicd /application/php/etc/cp php-fpm.conf.default php-fpm.confvim php-fpm.conf 里的pid = /app/logs/php-fpm.piderror_log = /app/logs/php-fpm.loglog_level = errorrlimit_files = 32768listen.owner = nginxlisten.owner = nginxpm.max_children = 1024pm.start_servers = 16pm.min_spare_servers = 5pm.max_spare_servers = 20pm.process_idle_timeout = 15s;pm.max_requests = 2048slowlog = /app/logs/$pool.log.slowrequest_slowlog_timeout = 10php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f wenxianfeng@linekong.commkdir /app/logs -p
/application/php/sbin/php-fpm -t/application/php/sbin/php-fpmnetstat -nltpu |grep php-fpmps -ef |grep php-fpm开机自启动/etc/rc.local
/etc/init.d/mysqld start/application/php/sbin/php-fpm/application/nginx1.6.2/sbin/nginx在nginx虚拟主机里加判定若是.php文件调用php的fastcgilocation ~ .*.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;include fastcgi.conf;}用下列php脚本测试nginx到mysql通否 wen.php
<?php$link_id=mysql_connect('localhost','root','123456') or mysql_error();if ($link_id) { echo "php-->mysqk successful";}else{ echo "php ->mysql error()";}
?>
刷新页面或/application/php/bin/php wen.php到http://kaiyuan.baike.com/ 下载HDwiki5.1正式版 GBK版放到站点目录下
unzip HDWiki-v5.1GBK-20141205.zip把wiki目录下的文件放到站点目录下给wiki所在站点目录权限 chown -R nginx.nginx bbs刷新网页,图形配置wikinginx反向代理
在服务器上搭nginx服务,服务正常后egrep -v "^$|#" nginx.conf.default > nginx.confupstream backend { server 后端web:80 max_fails=3 fail_timeout=30s;server 后端web:80 max_fails=3 fail_timeout=30s;}根据http://nginx.org/en/docs/http/ngx_http_upstream_module.html upstream 和proxy 模块在nginx虚拟主机里加上location / { proxy_pass ;}不断访问反向代理服务器看是否交给后端服务器处理或者写for循环在反向代理机器测试客户端解析域名成反向代理ip,反向代理交给后端服务器(ip),默认会读取第一个虚拟主机,要是想读取某个域名的虚拟主机,需在反向代理服务器配置文件里加proxy_set_header Host $host;proxy_set_header X-Forwarded-For $remote_addr;转载于:https://blog.51cto.com/11773959/2087956