Nginx+PHP+MYSQL搭建指南

前段时间由于哪位黑客恶意攻击我的网站,导致万网直接把我的主机停用,只好换VPS,配制自然没有独立主机高了,远程桌面就要等好久,对于我 这个急性子的人来说无疑是受不了,所以琢磨换成linux性能应该好点。好了天研究,终于把整个环境配制好了。费话少说,直接下面的介绍。

一、编译nginx,然后下载nginx最后源代码版(1.3.3),下载地址为http://nginx.org/download/nginx-1.3.3.tar.gz,直接通过wget即可:

wget -c http://nginx.org/download/nginx-1.3.3.tar.gz

mkdir -p /usr/src/nginx

cd /usr/src/nginx

tar -xzvf nginx-1.3.3.tar.gz

cd nginx-1.3.3.

useradd www

usemod -s /sbin/nologin -g www www

./configure –prefix=/usr/local/nginx –user=www –group=www –with-http_stub_status_module –with-http_ssl_module –with-pcre && make && make install

(注:不要加上–without-http_rewrite_module,否则会导致rewrite无法使用)

编译完以后,就可以通过下面命令启动nginx:

/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

二、编译PHP,下载源代码包,http://118.26.57.11/1Q2W3E4R5T6Y7U8I9O0P1Z2X3C4V5B/cn.php.net/distributions/php-5.4.5.tar.bz2

mkdir -p /usr/src/nginx/php

cd /usr/src/nginx/php

wget -c http://118.26.57.11/1Q2W3E4R5T6Y7U8I9O0P1Z2X3C4V5B/cn.php.net/distributions/php-5.4.5.tar.bz2

tar -jxvf php-5.4.5.tar.bz2

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel mysql

./configure –prefix=/usr/local/php –with-mysql –enable-fpm –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir –enable-xml –disable-debug –enable-safe-mode –enable-mbstring && make && make install

cp -R ./sapi/fpm/php-fpm.conf /usr/local/php/etc/php-fpm.conf

cp -R ./sapi/fpm/php-fpm /etc/init.d/php-fpm #php-fpm启动

/etc/init.d/php-fpm

三、安装MYSQL,下载安装包

posted @ 2016-12-25 21:40  371502685  阅读(362)  评论(0编辑  收藏  举报