CentOS release 6.5 (Final)x86_64
lamp
apache
wget http://archive.apache.org/dist/httpd/httpd-2.2.27.tar.gz
tar cd
./configure --prifix=/application/apache2.2.27 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite
yum install -y zlib-devel
make && make install
ln -s /application/apache2.2.27/ /application/apache
ll /application/apache/conf/httpd.conf
/application/apache/bin/apachectl -t
/application/apache/bin/apachectl graceful
ps -ef|grep httpd
mqsql
wget https://downloads.mysql.com/archives/get/file/mysql-5.1.68.tar.gz
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-devel
make && 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-devel
2.php包
http://php.net/get/php-5.3.27.tar.gz/from/a/mirror下到本地,传到用户家目录
tar xf php-5.3.27.tar.gz
cd 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-dir
make
make install
ln -s /application/php5.3.27 /application/php
cp 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.html
useradd -M -s /sbin/nologin www
/application/apache/bin/apachectl graceful
测试浏览器--index.html>>apache--index.php>>php--php脚本>>mysql
php脚本内容
<?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 http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
useradd -M -s /sbin/nologin nginx
yum 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_module
make
make install
/application/nginx1.6.2/sbin/nginx -t
/application/nginx1.6.2/sbin/nginx
ps -ef |grep nginx
注意防火墙
用二进制文件装mysql
wget https://downloads.mysql.com/archives/get/file/mysql-5.5.32-linux2.6-x86_64.tar.gz --no-check-certificate
tar -zxvf mysql-5.5.32-linux2.6-x86_64.tar.gz
mv mysql-5.5.32-linux2.6-x86_64 /application/mysql
cp my-small.cnf /etc/my.cnf
useradd -M -s /sbin/nologin mysql
./mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data
cp support-files/mysql.server /etc/init.d/mysqld
修改/etc/init.d/mysqld里的basedir 和datadir
/etc/init.d/mysqld start
测试
/application/mysql/bin/mysql
export PATH=$PATT:/application/mysql/bin/mysql
php
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++ libxslt
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar -zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make && make install
wget https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz --no-check-certificate
tar -zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
sleep 2
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install
wget https://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz --no-check-certificate
tar -zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make && make install
rm -f /usr/lib64/libmhash.
rm -f /usr/lib64/libmcrypt.*
ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1
ln -s /usr/local/lib64/libmcrypt-config /usr/lib64/libmcrypt-config
wget https://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz --no-check-certificate
tar -zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
/sbin/ldconfig
./configure LD_LIBRARY_PATH=/usr/local/lib
make
make install
php安装
wget http://mirrors.sohu.com/php/php-5.3.27.tar.gz
tar -zxvf php-5.3.27.tar.gz
cd 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-ftp
ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64
make
make install
ln -s /application/php5.3.27/ /application/php
cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc/
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf 里的
pid = /app/logs/php-fpm.pid
error_log = /app/logs/php-fpm.log
log_level = error
rlimit_files = 32768
listen.owner = nginx
listen.owner = nginx
pm.max_children = 1024
pm.start_servers = 16
pm.min_spare_servers = 5
pm.max_spare_servers = 20
pm.process_idle_timeout = 15s;
pm.max_requests = 2048
slowlog = /app/logs/$pool.log.slow
request_slowlog_timeout = 10
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f wenxianfeng@linekong.com
mkdir /app/logs -p
/application/php/sbin/php-fpm -t
/application/php/sbin/php-fpm
netstat -nltpu |grep php-fpm
ps -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的fastcgi
location ~ .*.(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
刷新网页,图形配置wiki
nginx反向代理
在服务器上搭nginx服务,服务正常后
egrep -v "^$|#" nginx.conf.default > nginx.conf
upstream 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 http://backend;
}
不断访问反向代理服务器看是否交给后端服务器处理或者写for循环在反向代理机器测试
客户端解析域名成反向代理ip,反向代理交给后端服务器(ip),默认会读取第一个虚拟主机,要是想读取某个域名的虚拟主机,需在反向代理服务器配置文件里加
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。