怎样卸载mac nginx php mysql+php+mysql

Win7配置Nginx+PHP+MySQL 坑爹的性能 - 飞晏博客
Win7配置Nginx+PHP+MySQL 坑爹的性能
周末主动在家加班,由于公司全线产品都使用Nginx,而我使用的是PHPnow集成包,我早就对里面低版本的PHP和MySQL不满了(O(∩_∩)O~),趁此机会撤换掉。Nginx、PHP和MySQL都有相应的Windows版本,去各自网站下载。由于Nginx使用fastcgi运行PHP,所以不用纠结PHP的版本,下载最新版的即可。Nginx:PHP:MySQL:下载完后首先安装MySQL,基本上一路过去点Next就行,我是习惯把这些应用都安装在一个单独的目录;Nginx和PHP解压缩好就行了,不需要安装。使用的时候运行nginx.exe即可,PHP的目录下有php.ini-development文件,修改为php.ini,还有php-cgi.exe,在命令里面运行php-cgi.exe也可以,不过这个方式很坑爹,不像nginx.exe打开后是在后台运行的。凭我这Windows水平,我尝试着把这两个服务像MySQL一样加入到系统服务里面并且设置为开机自动启动,各种修改注册表都宣告失败,最后发现别人的脚步:createobject("wscript.shell").run "D:/PHP/PHP-5.4.8/php-cgi.exe -b 127.0.0.1:9000 -c D:/PHP/PHP-5.4.8/php.ini",0存为VBS脚本,每次使用的时候运行一下就行,如果要同时关闭Nginx和fastcgi,则把下面的脚本存储为.bat文件后运行:@echo off
echo Stopping nginx...
taskkill /F /IM nginx.exe & nul
echo Stopping PHP FastCGI...
taskkill /F /IM php-cgi.exe & nul
exit本来以为苦逼的Windows到此为止,没想到在Windows下Nginx经常性的挂,稍微复杂一点的逻辑或者跑一次大数据就得死,坑爹至极,看来我的开发在Windows下已经不适合了,而Nginx这么优秀的服务应该也只是为了照顾Windows而已。最后果断开一个虚拟机专门跑Nginx吧。
文章标签:
本文地址:JunStar 的BLOG
用户名:JunStar
文章数:12
访问量:1107
注册日期:
阅读量:5863
阅读量:12276
阅读量:367271
阅读量:1062158
51CTO推荐博文
一.使用yum命令,安装所需的程序库&&&&& & 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 openldap openldap-devel nss_ldap openldap-clients openldap-servers&&&&&& &&2.命令执行结果二.安装Nginx&&&&&&&&&&1.使用yum安装,命令为:&&&&&&&&&&&&yum install -y nginx&&&&&&&&&&下图是执行结果:如果出现如下错误:请先安装epel:&&&&&&&&&&& 1.使用命令:yum install -y epel-release&&&&&&&&&&&&2.使用命令:rpm -Uvh&&安装好epel后再安装nginx&&&&&& & 2.验证是否安装成功,尝试启动nginx&&&&&&&&& & service nginx start三.安装PHP及若干扩展&&&&& & 1.使用yum安装php&&&&& & & &&yum install -y php php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt libmcrypt-devel php-fpm&&&&&&&&2.启动php-fpm&&&&&& & & &&/etc/rc.d/init.d/php-fpm start&&&&&&&&&3.设置开机启动项&&&&& & & &&chkconfig php-fpm on四.配置Nginx支持PHP&& & & & 1.备份php-fpm的配置文件&&&&& & & &&cp /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.confbak&&&&&& & 2.修改配置文件&&&&& & & &&vim /etc/php-fpm.d/www.conf&& & & &&#修改用户为nginx&&&&&&&&&&&user & &= nginx& & &&&#修改组为nginx&&&&&&&&& &group = nginx&&五.安装Mysql&&&&& & 1.使用yum直接安装mysql&&&&&& & & &&yum -y install mysql mysql-server&&&&&&&&2.启动Mysql,验证Mysql安装是否成功&&&&& & & &&service mysqld start&&&&&&&&&3.设置开机启动项&&&&& & & &&chkconfig mysqld on&六.附Nginx、Mysql、PHP重启命令& & & & #重启nginx&&&&&&&&service nginx restart&&&&& &&#重启mysql& & & &&service mysqld restart&& & & &&#重启php&&&&&&&&&/etc/rc.d/init.d/php-fpm restart&本文出自 “” 博客,请务必保留此出处
了这篇文章
类别:┆阅读(0)┆评论(0)Nginx+php-fpm+MySQL分离部署详解_服务器应用_Linux公社-Linux系统门户网站
你好,游客
Nginx+php-fpm+MySQL分离部署详解
来源:Linux社区&
作者:tae44
相信大家将这三者部署到同一台主机应该已经不陌生了,今天在这里,给大家演示一下如何将三者部署到三台主机上。
实验系统: 6.6_x86_64
实验前提:大部分软件使用编译安装,请提前准备好编译环境,防火墙和selinux都关闭
实验软件:nginx-1.9.3 mariadb-10.0.20 php-5.6.11 memcache-2.2.7 xcache-3.2.0
实验拓扑:
Nginx+PHP-FPM时快时慢的解决&
LAMP-PHP-fpm服务器配置
14.04 LTS 安装 LNMP Nginx\PHP5 (PHP-FPM)\MySQL
高负载PHP-FPM调优
Nginx php-fpm出现502解决办法和调优心得
Nginx+PHP-FPM在两台服务器实现
Ubuntu 10.04配置 nginx + php-fpm 模式
Nginx&&PHP-FPM配置及优化指南(上)
一、安装nginx
  1.解决依赖关系:
    需要专门安装pcre-devel包:
1 yum -y install pcre-devel
  2.添加nginx用户:
1 useradd -r nginx
  3.解压并编译安装nginx:
1 tar xf nginx-1.9.3.tar.gz
2 cd nginx-1.9.3
3 ./configure \
--prefix=/usr/local/nginx \                    //安装位置
--sbin-path=/usr/local/nginx/sbin/nginx \            //程序文件
--conf-path=/etc/nginx/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
\              //pid文件位置
--lock-path=/var/lock/nginx.lock \                //锁文件位置
--user=nginx \                            //运行进程时使用的用户身份
--group=nginx \                           //运行进程时使用的用户组
--with-http_ssl_module \                      //支持ssl模块
--with-http_flv_module \                      //支持flv模块
--with-http_stub_status_module \                 //支持stub_status模块
--with-http_gzip_static_module \                 //支持gzip_static模块
--http-client-body-temp-path=/var/tmp/nginx/client/ \    //存储HTTP客户端请求body体的临时文件位置
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \        //存储HTTP代理的临时文件位置
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \        //存储fasycgi临时文件位置
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \         //存储uwsgi临时文件位置
--http-scgi-temp-path=/var/tmp/nginx/scgi \          //存储scgi临时文件位置
--with-pcre                             //支持pcre库
23 make && make install
  4.提供脚本文件:
1 vim /etc/init.d/nginx
2 --------------------------------
3 #!/bin/sh
5 # nginx - this script starts and stops the nginx daemon
7 # chkconfig:
8 # description:
Nginx is an HTTP(S) server, HTTP(S) reverse \
proxy and IMAP/POP3 proxy server
10 # processname: nginx
11 # config:
/etc/nginx/nginx.conf
12 # config:
/etc/sysconfig/nginx
13 # pidfile:
/var/run/nginx.pid
15 # Source function library.
16 . /etc/rc.d/init.d/functions
18 # Source networking configuration.
19 . /etc/sysconfig/network
21 # Check that networking is up.
22 [ "$NETWORKING" = "no" ] && exit 0
24 nginx="/usr/local/nginx/sbin/nginx"
25 prog=$(basename $nginx)
27 NGINX_CONF_FILE="/etc/nginx/nginx.conf"
29 [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
31 lockfile=/var/lock/subsys/nginx
33 make_dirs() {
# make required directories
user=`nginx -V 2&&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
options=`$nginx -V 2&&1 | grep 'configure arguments:'`
for opt in $ do
if [ `echo $opt | grep '.*-temp-path'` ]; then
value=`echo $opt | cut -d "=" -f 2`
if [ ! -d "$value" ]; then
# echo "creating" $value
mkdir -p $value && chown -R $user $value
48 start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
[ $retval -eq 0 ] && touch $lockfile
return $retval
60 stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
69 restart() {
configtest || return $?
76 reload() {
configtest || return $?
echo -n $"Reloading $prog: "
killproc $nginx -HUP
84 force_reload() {
88 configtest() {
$nginx -t -c $NGINX_CONF_FILE
92 rh_status() {
status $prog
96 rh_status_q() {
rh_status &/dev/null 2&&1
100 case "$1" in
rh_status_q && exit 0
rh_status_q || exit 0
restart|configtest)
rh_status_q || exit 7
force-reload)
force_reload
condrestart|try-restart)
rh_status_q || exit 0
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
129 --------------------------------
130 chmod +x /etc/init.d/nginx
131 chkconfig --add nginx
132 chkconfig nginx on
133 service nginx start
  5.测试访问页面,nginx安装完毕:
二、安装mysql
  1.添加mysql用户和创建数据目录:
1 useradd -r mysql
2 mkdir -pv /mydata/data
3 chown -R mysql:mysql /mydata/data
  2.解压并初始化mysql:
1 tar xf mariadb-10.0.20-linux-x86_64.tar.gz -C /usr/local/
2 cd /usr/local/
3 ln -sv mariadb-10.0.20-linux-x86_64 mysql
4 cd mysql/
5 chown -R root:mysql .
6 scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
  3.提供配置文件:
1 cp support-files/f /etc/my.cnf
2 vim /etc/my.cnf
3 修改此文件中thread_concurrency的值为你的CPU个数乘以2,比如:thread_concurrency = 2
4 另外还需要添加如下行指定mysql数据文件的存放位置:datadir = /mydata/data
  4.提供脚本文件:
1 cp support-files/mysql.server /etc/init.d/mysqld
2 chkconfig --add mysqld
3 chkconfig mysqld on
4 service mysqld start
  使用mysql目录的下的bin/mysql去连接mysql,出现如下画面表示连接成功:
  5.输出mysql的man手册至man命令的查找路径:   
    编辑/etc/man.config,添加如下行即可:MANPATH &/usr/local/mysql/man
  6.输出mysql的头文件至系统头文件路径/usr/include:
    这可以通过简单的创建链接实现:&
1 ln -sv /usr/local/mysql/include
/usr/include/mysql
  7.输出mysql的库文件给系统库查找路径:
1 echo '/usr/local/mysql/lib' & /etc/ld.so.conf.d/mysql.conf
2 ldconfig
三、安装PHP
  1.解决依赖关系:
1 yum -y install libxml2-devel bzip2-devel libcurl-devel libmcrypt-devel
  2.编译安装php:
1 ./configure --prefix=/usr/local/php \      //安装位置
--with-mysql \                   //支持mysql
--with-pdo-mysql \                //支持pdo模块
--with-mysqli \                  //支持mysqli模块         
--with-openssl \                  //支持openssl模块
--enable-fpm \                   //支持fpm模式
--enable-sockets \                //启用socket支持
--enable-sysvshm \                //启用系统共享内存支持
--enable-mbstring \                //使多字节字符串的支持
--with-freetype-dir \              //设置FreeType安装前缀路径
--with-jpeg-dir \                //设置libjpeg安装前缀路径
--with-png-dir \              
 //设置libpng安装前缀路径
--with-zlib-dir \                //设置libz安装前缀路径
--with-libxml-dir=/usr \            //设置libxml2安装路径
--enable-xml \                 16
--with-mhash \                 //支持mhash
--with-mcrypt \                 //支持mcrypt
--with-config-file-path=/etc \        //配置文件路径
--with-config-file-scan-dir=/etc/php.d \
//配置文件扫描路径
--with-bz2 \
              //支持BZip2
--with-curl                   //支持curl
22 make && make install
  3.提供配置文件:
1 cp php.ini-production /etc/php.ini
  4.为php-fpm提供脚本:
1 cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
2 chmod +x /etc/init.d/php-fpm
3 chkconfig --add php-fpm
4 chkconfig php-fpm on
  5.提供php-fpm配置文件并编辑:
1 cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
2 ------------------------------------------------------
3 pm.max_children = 150
4 pm.start_servers = 8
5 pm.min_spare_servers = 5
6 pm.max_spare_servers = 10
7 pid = /usr/local/php/var/run/php-fpm.pid
  6.启动php-fpm服务:
1 service php-fpm start
四、整合nginx与PHP
  1.nginx服务器建立网页文件存放目录/www,并修改其权限:
1 mkdir /www
2 chown -R nginx:nginx /www
  2.修改nginx配置文件:
1 vim /etc/nginx/nginx.conf
2 --------------------------------------
3 location / {
index.php index.html index.
8 location ~ \.php$ {
fastcgi_pass
192.168.19.92:9000;
fastcgi_index
fastcgi_param
SCRIPT_FILENAME
$document_root$fastcgi_script_
  3.修改fastcgi_params文件为:
1 fastcgi_param
GATEWAY_INTERFACE
2 fastcgi_param
SERVER_SOFTWARE
3 fastcgi_param
QUERY_STRING
4 fastcgi_param
REQUEST_METHOD
5 fastcgi_param
CONTENT_TYPE
6 fastcgi_param
CONTENT_LENGTH
7 fastcgi_param
SCRIPT_FILENAME
$document_root$fastcgi_script_
8 fastcgi_param
SCRIPT_NAME
$fastcgi_script_
9 fastcgi_param
REQUEST_URI
10 fastcgi_param
DOCUMENT_URI
$document_
11 fastcgi_param
DOCUMENT_ROOT
$document_
12 fastcgi_param
SERVER_PROTOCOL
13 fastcgi_param
REMOTE_ADDR
14 fastcgi_param
REMOTE_PORT
15 fastcgi_param
SERVER_ADDR
16 fastcgi_param
SERVER_PORT
17 fastcgi_param
SERVER_NAME
  4.在PHP服务器上,建立nginx用户,要保证和nginx服务器上的nginx用户id号、组id号一致:
  5.修改php-fpm配置文件,并重启:
1 vim /usr/local/php/etc/php-fpm.conf
2 ---------------------------------------------
3 listen = 192.168.19.92:9000
    //监听物理网卡地址,供其它机器调用
4 user = nginx
//php-fpm以nginx用户运行
5 group = nginx
6 ---------------------------------------------
7 service php-fpm restart
  6.在PHP服务器上创建/www目录,并开启nfs服务:
1 mkdir /www
2 chown -R nginx:nginx /www
3 vim /etc/exports
4 ---------------------------------------------
192.168.19.0/24(rw,no_root_squash)
6 ---------------------------------------------
7 service nfs start
  7.nginx服务器挂载nfs文件,并测试php,测试成功后删除index.php:
1 mount -t nfs 192.168.19.92:/www /www
2 vim /www/index.php
3 ---------------------------------------
phpinfo();
7 --------------------------------------
8 service nginx restart
更多详情见请继续阅读下一页的精彩内容:
相关资讯 & & &
& (12/29/:05)
& (07/25/:49)
& (03月30日)
& (10/14/:38)
& (07/25/:19)
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款lihuipeng 的BLOG
用户名:lihuipeng
文章数:259
评论数:346
访问量:461549
注册日期:
阅读量:5863
阅读量:12276
阅读量:367271
阅读量:1062158
51CTO推荐博文
Mysql版本为5.0
数据目录:/data/mysql
网站目录:/data/www
测试环境:centos32位和64位
&#!/bin/bash
dir='/opt'
mysql_download='http://mirror.trouble-free.net/mysql_mirror/Downloads/MySQL-5.0/mysql-5.0.92.tar.gz'
nginx_download='http://nginx.org/download/nginx-1.1.7.tar.gz'
pcre_download='http://nchc.dl.sourceforge.net/project/pcre/pcre/8.20/pcre-8.20.zip'
libiconv_download='http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz'
libmcrypt_download='http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=&big_mirror=0'
mcrypt_download='http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=&big_mirror=0'
mhash_download='http://downloads.sourceforge.net/mhash/mhash-0.9.9.9.tar.gz?modtime=&big_mirror=0'
php_download='http://cn.php.net/distributions/php-5.2.17.tar.bz2'
php_fpm_download='http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz'
memcache_download='http://pecl.php.net/get/memcache-2.2.6.tgz'
eaccelerator_download='/soft/linux/nginx_php/eaccelerator/eaccelerator-0.9.6.1.tar.bz2'
PDO_MYSQL_download='http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz'
ImageMagick_download='/soft/linux/nginx_php/imagick/ImageMagick.tar.gz'
imagick_download='http://pecl.php.net/get/imagick-2.3.0.tgz'
memcached_download='/files/memcached-1.4.5.tar.gz'
libevent_download='http://monkey.org/~provos/libevent-2.0.11-stable.tar.gz'
function __install_mysql()
/usr/sbin/groupadd mysql
/usr/sbin/useradd -m mysql -g mysql -d /usr/local/mysql -s /sbin/nologin
wget $mysql_download
filename=`ls mysql*`
foldername=`echo $filename | sed 's/\.tar.gz//'`
tar zxvf $filename
cd $foldername
./configure &--prefix=/usr/local/mysql \
&&--localstatedir=/data/mysql \
&&--enable-static \
&&--with-client-ldflags=-all-static \
&&--with-mysqld-ldflags=-all-static \
&&--with-charset=utf8 \
&&--with-extra-charsets=all \
&&--with-berkeley-db \
&&--with-innodb \
&&--without-readline \
&&--enable-assembler \
&&--with-pthread \
&&--enable-thread-safe-client \
&&--without-debug \
&&--without-ndb-debug
make install
function __install_mysql_management()
mkdir -p /data/mysql
filename=`basename $mysql_download`
foldername=`echo $filename | sed 's/\.tar.gz//'`
cat & /f && &EOF&
port&&&&&&&&&&& = 3306
socket&&&&&&&&& = /tmp/mysql.sock
port&&&&&&&&&&& = 3306
socket&&&&&&&&& = /tmp/mysql.sock
skip-locking
skip-name-resolve
#skip-innodb
max_allowed_packet = 8M
table_cache = 2048
sort_buffer_size = 2M
read_buffer_size = 2M
query_cache_limit = 2M
myisam_sort_buffer_size = 128M
thread_cache_size = 256
query_cache_size = 128M
thread_concurrency = 8
#log-bin=mysql-bin
#log-slow-queries=slowquery.log
#long_query_time = 60
default-character-set=utf8
max_user_connections=5000
max_connections=8000
wait_timeout=
tmp_table_size = 384M
bulk_insert_buffer_size = 512M
concurrent_insert = 2
back_log = 512
[mysqldump]
max_allowed_packet = 16M
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 512M
sort_buffer_size = 512M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
datadir=/data/mysql
[mysqld_safe]
open_files_limit = 65535
/usr/local/mysql/bin/mysql_install_db --user=mysql
chown -R mysql:mysql /data/mysql
/usr/local/mysql/bin/mysqld_safe --user=mysql &
cp &$foldername&/support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
/sbin/chkconfig --add mysql
/sbin/chkconfig --level 35 mysql on
/sbin/service mysql start
/usr/local/mysql/bin/mysqladmin -u root password
ln -s /usr/local/mysql/bin/mysql /sbin/mysql
ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
function __install_lib()
yum -y install gcc gcc-c++ bison patch unzip mlocate flex wget automake autoconf gd cpp gettext readline-devel 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 libidn libidn-devel openldap \
&openldap-devel openldap-clients openldap-servers nss_ldap expat-devel libtool libtool-ltdl-devel bison openssl openssl-devel
function __install_libiconv()
wget $libiconv_download
filename=`ls libiconv*`
foldername=`echo $filename | sed 's/\.tar\.gz//'`
tar zxvf $filename
cd $foldername
./configure
make install
function __install_libmcrypt()
wget $libmcrypt_download
filename=`ls libmcrypt*`
foldername=`echo $filename | sed 's/\.tar\.gz//'`
tar zxvf $filename
cd $foldername
./configure
make install
/sbin/ldconfig
cd libltdl
./configure --enable-ltdl-install
make install
ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
function __install_mhash()
wget $mhash_download
filename=`ls mhash*`
foldername=`echo $filename | sed 's/\.tar\.gz//'`
tar zxvf $filename
cd $foldername
./configure
make install
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
function __install_mcrypt()
wget $mcrypt_download
filename=`ls mcrypt*`
foldername=`echo $filename | sed 's/\.tar\.gz//'`
tar zxvf& $filename
cd $foldername
/sbin/ldconfig
./configure
make install
function __install_php()
if [ `getconf LONG_BIT` == 64 ]
&cp -rp /usr/lib64/libjpeg.* /usr/lib/
&cp -rp /usr/lib64/libpng* /usr/lib/
&cp -rp /usr/lib64/libldap* /usr/lib/
wget $php_download
filename=`ls php*`
foldername=`echo $filename | sed 's/\.tar\.bz2//'`
tar jxvf $filename
rm -f $filename
wget $php_fpm_download
filename=`ls *diff.gz`
gzip -cd $filename | patch -d $foldername -p1
cd $foldername
./configure &--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-iconv-dir=/usr/local \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-discard-path \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl --with-curlwrappers \
--enable-mbregex \
--enable-fastcgi \
--enable-fpm \
--enable-force-cgi-redirect \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-ldap \
--with-ldap-sasl \
--with-xmlrpc \
--enable-zip \
--enable-soap
make ZEND_EXTRA_LIBS='-liconv'
make install
cp php.ini-dist /usr/local/php/etc/php.ini
/usr/local/php/etc/php.ini
sed -i 's@;
/usr/local/php/etc/php.ini
rm -f /usr/local/php/etc/php-fpm.conf
cat & /usr/local/php/etc/php-fpm.conf && &EOF&
&?xml version=&1.0& ?&
&configuration&
& All relative paths in this config are relative to php's install prefix
& &section name=&global_options&&
&&& Pid file
&&& &value name=&pid_file&&/usr/local/php/logs/php-fpm.pid&/value&
&&& Error log file
&&& &value name=&error_log&&/usr/local/php/logs/php-fpm.log&/value&
&&& Log level
&&& &value name=&log_level&&notice&/value&
&&& When this amount of php processes exited with SIGSEGV or SIGBUS ...
&&& &value name=&emergency_restart_threshold&&10&/value&
&&& ... in a less than this interval of time, a graceful restart will be initiated.
&&& Useful to work around accidental curruptions in accelerator's shared memory.
&&& &value name=&emergency_restart_interval&&1m&/value&
&&& Time limit on waiting child's reaction on signals from master
&&& &value name=&process_control_timeout&&5s&/value&
&&& Set to 'no' to debug fpm
&&& &value name=&daemonize&&yes&/value&
& &/section&
& &workers&
&&& &section name=&pool&&
&&&&& Name of pool. Used in logs and stats.
&&&&& &value name=&name&&default&/value&
&&&&& Address to accept fastcgi requests on.
&&&&& Valid syntax is 'ip.ad.re.ss:port' or just 'port' or '/path/to/unix/socket'
&&&&& &value name=&listen_address&&127.0.0.1:9000&/value&
&&&&& &value name=&listen_options&&
&&&&&&& Set listen(2) backlog
&&&&&&& &value name=&backlog&&-1&/value&
&&&&&&& Set permissions for unix socket, if one used.
&&&&&&& In Linux read/write permissions must be set in order to allow connections from web server.
&&&&&&& Many BSD-derrived systems allow connections regardless of permissions.
&&&&&&& &value name=&owner&&&/value&
&&&&&&& &value name=&group&&&/value&
&&&&&&& &value name=&mode&&0666&/value&
&&&&& &/value&
&&&&& Additional php.ini defines, specific to this pool of workers.
&&&&& &value name=&php_defines&&
&&&&&&& &value name=&sendmail_path&&/usr/sbin/sendmail -t -i&/value&
&&&&&&& &value name=&display_errors&&0&/value&
&&&&& &/value&
&&&&& Unix user of processes
&&&&& &value name=&user&&www&/value&
&&&&& Unix group of processes
&&&&& &value name=&group&&www&/value&
&&&&& Process manager settings
&&&&& &value name=&pm&&
&&&&&&& Sets style of controling worker process count.
&&&&&&& Valid values are 'static' and 'apache-like'
&&&&&&& &value name=&style&&static&/value&
&&&&&&& Sets the limit on the number of simultaneous requests that will be served.
&&&&&&& Equivalent to Apache MaxClients directive.
&&&&&&& Equivalent to PHP_FCGI_CHILDREN environment in original php.fcgi
&&&&&&& Used with any pm_style.
&&&&&&& &value name=&max_children&&128&/value&
&&&&&&& Settings group for 'apache-like' pm style
&&&&&&& &value name=&apache_like&&
&&&&&&&&& Sets the number of server processes created on startup.
&&&&&&&&& Used only when 'apache-like' pm_style is selected
&&&&&&&&& &value name=&StartServers&&20&/value&
&&&&&&&&& Sets the desired minimum number of idle server processes.
&&&&&&&&& Used only when 'apache-like' pm_style is selected
&&&&&&&&& &value name=&MinSpareServers&&5&/value&
&&&&&&&&& Sets the desired maximum number of idle server processes.
&&&&&&&&& Used only when 'apache-like' pm_style is selected
&&&&&&&&& &value name=&MaxSpareServers&&35&/value&
&&&&&&& &/value&
&&&&& &/value&
&&&&& The timeout (in seconds) for serving a single request after which the worker process will be terminated
&&&&& Should be used when 'max_execution_time' ini option does not stop script execution for some reason
&&&&& '0s' means 'off'
&&&&& &value name=&request_terminate_timeout&&0s&/value&
&&&&& The timeout (in seconds) for serving of single request after which a php backtrace will be dumped to slow.log file
&&&&& '0s' means 'off'
&&&&& &value name=&request_slowlog_timeout&&0s&/value&
&&&&& The log file for slow requests
&&&&& &value name=&slowlog&&logs/slow.log&/value&
&&&&& Set open file desc rlimit
&&&&& &value name=&rlimit_files&&65535&/value&
&&&&& Set max core size rlimit
&&&&& &value name=&rlimit_core&&0&/value&
&&&&& Chroot to this directory at the start, absolute path
&&&&& &value name=&chroot&&&/value&
&&&&& Chdir to this directory at the start, absolute path
&&&&& &value name=&chdir&&&/value&
&&&&& Redirect workers' stdout and stderr into main error log.
&&&&& If not set, they will be redirected to /dev/null, according to FastCGI specs
&&&&& &value name=&catch_workers_output&&yes&/value&
&&&&& How much requests each process should execute before respawn.
&&&&& Useful to work around memory leaks in 3rd party libraries.
&&&&& For endless request processing please specify 0
&&&&& Equivalent to PHP_FCGI_MAX_REQUESTS
&&&&& &value name=&max_requests&&1024&/value&
&&&&& Comma separated list of ipv4 addresses of FastCGI clients that allowed to connect.
&&&&& Equivalent to FCGI_WEB_SERVER_ADDRS environment in original php.fcgi (5.2.2+)
&&&&& Makes sense only with AF_INET listening socket.
&&&&& &value name=&allowed_clients&&127.0.0.1&/value&
&&&&& Pass environment variables like LD_LIBRARY_PATH
&&&&& All $VARIABLEs are taken from current environment
&&&&& &value name=&environment&&
&&&&&&& &value name=&HOSTNAME&&$HOSTNAME&/value&
&&&&&&& &value name=&PATH&&/usr/local/bin:/usr/bin:/bin&/value&
&&&&&&& &value name=&TMP&&/tmp&/value&
&&&&&&& &value name=&TMPDIR&&/tmp&/value&
&&&&&&& &value name=&TEMP&&/tmp&/value&
&&&&&&& &value name=&OSTYPE&&$OSTYPE&/value&
&&&&&&& &value name=&MACHTYPE&&$MACHTYPE&/value&
&&&&&&& &value name=&MALLOC_CHECK_&&2&/value&
&&&&& &/value&
&&& &/section&
& &/workers&
&/configuration&
echo &/usr/local/php/sbin/php-fpm start& && /etc/rc.local
function __install_memcache()
wget $memcache_download
filename=`ls memcache-*`
foldername=`echo $filename | sed s'/\.tgz//'`
tar zxvf $filename
cd $foldername
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make install
/usr/local/php/etc/php.ini
sed -i '492iextension = &memcache.so&' /usr/local/php/etc/php.ini
function __install_eaccelerator()
wget $eaccelerator_download
filename=`ls eaccelerator*`
foldername=`echo $filename | sed 's/\.tar\.bz2//'`
tar jxvf $filename
cd $foldername
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make install
mkdir -p /tmp/eaccelerator
cat && /usr/local/php/etc/php.ini && &EOF&
[eaccelerator]
zend_extension=&/usr/local/php/lib/php/extensions/no-debug-non-zts-/eaccelerator.so&
eaccelerator.shm_size=&64&
eaccelerator.cache_dir=&/tmp/eaccelerator&
eaccelerator.enable=&1&
eaccelerator.optimizer=&1&
eaccelerator.check_mtime=&1&
eaccelerator.debug=&0&
eaccelerator.filter=&&
eaccelerator.shm_max=&0&
eaccelerator.shm_ttl=&3600&
eaccelerator.shm_prune_period=&3600&
eaccelerator.shm_only=&0&
press_level=&9&
function __install_PDO_MYSQL()
wget $PDO_MYSQL_download
filename=`ls PDO_MYSQL*`
foldername=`echo $filename | sed 's/\.tgz//'`
tar zxvf $filename
cd $foldername
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
make install
sed -i '492iextension = &pdo_mysql.so&' /usr/local/php/etc/php.ini
function __install_ImageMagick()
wget $ImageMagick_download
filename=`ls ImageMagick*`
foldername='ImageMagick-6.5.1-2'
tar zxvf $filename
cd $foldername
./configure
make install
function __install_imagick()
wget $imagick_download
filename=`ls imagick*`
foldername=`echo $filename | sed 's/\.tgz//'`
tar zxvf $filename
cd $foldername
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make install
sed -i '492iextension = &imagick.so&' /usr/local/php/etc/php.ini
if [ `getconf LONG_BIT` == 64 ]
&ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/
&ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/
function __install_memcached(){
&wget $libevent_download
&filename=`ls libevent-*`
&foldername=`echo $filename | sed 's/\.tar\.gz//'`
&tar zxvf $filename
&cd $foldername
&./configure
&make install
&ln -s /usr/local/lib/libevent-1.4.so.2 /usr/lib
&wget $memcached_download
&filename=`ls memcached-*`
&foldername=`echo $filename | sed 's/\.tar\.gz//'`
&tar zxvf $filename
&cd $foldername
&./configure --prefix=/usr/local/memcached --with-libevent=/usr
&make install
&echo &/usr/local/memcached/bin/memcached -d -m 64 -p 11211 -u www -l localhost& && /etc/rc.local
function __install_pcre()
wget $pcre_download
filename=`ls pcre-*`
foldername=`echo $filename | sed 's/\.zip//'`
unzip $filename
cd $foldername
./configure
make install
function __install_nginx()
/usr/sbin/groupadd www
/usr/sbin/useradd -m www -g www -s /sbin/nologin -d /usr/local/nginx
mkdir -p /data/www
echo &&?php phpinfo();?&& & /data/www/index.php
mkdir -p /data/www/logs
chown -R www:www /data/www
wget $nginx_download
filename=`ls nginx-*`
foldername=`echo $filename | sed 's/\.tar\.gz//'`
tar zxvf $filename
cd $foldername
./configure &--prefix=/usr/local/nginx \
&&--with-http_stub_status_module \
&&--with-http_ssl_module \
&&--user=www \
&&--group=www \
&&--with-http_realip_module \
&&--with-http_flv_module \
&&--with-http_gzip_static_module
make install
mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak
cat & /usr/local/nginx/conf/nginx.conf && &EOF&
worker_processes 8;
worker_cpu_affinity 00 10 ;
error_log& /usr/local/nginx/logs/error.log&
pid&&&&&&& /usr/local/nginx/logs/nginx.
worker_rlimit_nofile 65535;
&worker_connections 65535;
&include&&&&&& mime.&&
& &default_type& application/octet-&&&&
&log_format& main& &'$remote_addr - $remote_user [$time_local] &$request& '
&&&&'$status $body_bytes_sent &$http_referer& '
&&&&'&$http_user_agent& $http_x_forwarded_for';
& &#charset& gb2312;&
& &server_names_hash_bucket_size 128;&&
& &client_header_buffer_size 32k;&
& &large_client_header_buffers 4 32k;&
& &client_max_body_size 30m;
& &tcp_nopush&&&&&&
& &keepalive_timeout 60;
& &server_
& &client_body_buffer_size 512k;
& &#proxy_connect_timeout&& 5;
& &#proxy_send_timeout&&&&& 60;
& &#proxy_read_timeout&&&&& 5;
& &#proxy_buffer_size&&&&&& 16k;
& &#proxy_buffers&&&&&&&&&& 4 64k;
& &#proxy_busy_buffers_size 128k;
& &#proxy_temp_file_write_size 128k;
& &fastcgi_connect_timeout 300;
& &fastcgi_send_timeout 300;
& &fastcgi_read_timeout 300;
& &fastcgi_buffer_size 64k;
& &fastcgi_buffers 4 64k;
& &fastcgi_busy_buffers_size 128k;
& &fastcgi_temp_file_write_size 128k;&&
& &gzip_min_length& 1k;
& &gzip_buffers&&&& 4 16k;
& &gzip_http_version 1.1;
& &gzip_comp_level 2;
& &gzip_types&&&&&& text/plain application/x-javascript text/css application/
& &#limit_zone& crawler& $binary_remote_addr& 10m; server
&&listen&&&&&& 80;
&&index index.html index.php index.
&&root& /data/
&&access_log& /data/www/logs/access_localhost.
&&if (-d $request_filename){
&&&rewrite ^/(.*)([^/])$
&&error_page&& 500 502 503 504 404 403 ;
&&location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
&&&expires 30d;
&&location ~ .*\.(js|css)?$ {
&&&expires 6h;
&&location ~ .*\.(log|txt)$
&&location ~ .*\.(php)?$
&&&fastcgi_pass& 127.0.0.1:9000;
&&&fastcgi_index index.
&&&include fcgi.
cat & /usr/local/nginx/conf/fcgi.conf && &EOF&
fastcgi_param& GATEWAY_INTERFACE& CGI/1.1;
fastcgi_param& SERVER_SOFTWARE&&&
fastcgi_param& QUERY_STRING&&&&&& $query_
fastcgi_param& REQUEST_METHOD&&&& $request_
fastcgi_param& CONTENT_TYPE&&&&&& $content_
fastcgi_param& CONTENT_LENGTH&&&& $content_
fastcgi_param& SCRIPT_FILENAME&&& $document_root$fastcgi_script_
fastcgi_param& SCRIPT_NAME&&&&&&& $fastcgi_script_
fastcgi_param& REQUEST_URI&&&&&&& $request_
fastcgi_param& DOCUMENT_URI&&&&&& $document_
fastcgi_param& DOCUMENT_ROOT&&&&& $document_
fastcgi_param& SERVER_PROTOCOL&&& $server_
fastcgi_param& REMOTE_ADDR&&&&&&& $remote_
fastcgi_param& REMOTE_PORT&&&&&&& $remote_
fastcgi_param& SERVER_ADDR&&&&&&& $server_
fastcgi_param& SERVER_PORT&&&&&&& $server_
fastcgi_param& SERVER_NAME&&&&&&& $server_
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param& REDIRECT_STATUS&&& 200;
echo &/usr/local/nginx/sbin/nginx& && /etc/rc.local
function __cutlog()
cat & /root/cutlog.sh && &EOF&
#!/bin/bash
if [ ! -d /data/nginx_log_backup ]
&&&&&&& mkdir -p /data/nginx_log_backup
date=`date -d yesterday +%y%m%d`
mkdir /data/nginx_log_backup/&$date&
for file in `ls /data/www/logs`
&&&&&&& mv /data/www/logs/&$file& /data/nginx_log_backup/&$date&/&$date&-&$file&
/usr/local/nginx/sbin/nginx -s reload
echo &00 00 * * * /bin/sh /root/cutlog.sh &/dev/null& && /var/spool/cron/root
#mysqldatadir:/data/mysql
#mysqluser:root
#mysqlpassword:
#webdir:/data/www
#installdir:/usr/local/
#srcdir:/opt
1.Only install Mysql&&&&&&&
2.Only install Nginx&&&
3.Install Nginx+php&&&&&&&&&
4.Install Mysql+Nginx+PHP
5.Install Mysql+Nginx+PHP+Memcached
6.Test option &
read -p &Which do you want to install{[0|1|2|3|4|5|6]}:& linecase $line in
&__install_mysql
&__install_mysql_complete
&__install_pcre
&__install_nginx
&/usr/local/nginx/sbin/nginx
&__install_lib
&__install_mysql
&__install_libiconv
&__install_libmcrypt
&__install_mhash
&__install_mcrypt
&__install_php
&__install_memcache
&__install_eaccelerator
&__install_PDO_MYSQL
&__install_ImageMagick
&__install_imagick
&__install_pcre
&__install_nginx
&/usr/local/php/sbin/php-fpm start
&/usr/local/nginx/sbin/nginx
&__install_lib
&__install_mysql
&__install_mysql_management
&__install_libiconv
&__install_libmcrypt
&__install_mhash
&__install_mcrypt
&__install_php
&__install_memcache
&__install_eaccelerator
&__install_PDO_MYSQL
&__install_ImageMagick
&__install_imagick
&__install_pcre
&__install_nginx
&/usr/local/php/sbin/php-fpm start
&/usr/local/nginx/sbin/nginx
&__install_lib
&__install_mysql
&__install_mysql_management
&__install_libiconv
&__install_libmcrypt
&__install_mhash
&__install_mcrypt
&__install_php
&__install_memcache
&__install_eaccelerator
&__install_PDO_MYSQL
&__install_ImageMagick
&__install_imagick
& __install_memcached
& /usr/local/memcached/bin/memcached -d -m 64 -p 11211 -u www -l localhost
&__install_pcre
&__install_nginx
&/usr/local/php/sbin/php-fpm start
&/usr/local/nginx/sbin/nginx
&echo &test option!&
&echo &Usage: `basename $0` {0|1|2|3|4|5|6}& &&2
本文出自 “” 博客,请务必保留此出处
了这篇文章
附件下载:  
类别:┆阅读(0)┆评论(0)
19:55:42 21:48:14 21:48:32 09:11:33 09:22:24 09:31:20 09:38:25 09:39:36 10:51:09
请输入验证码:

我要回帖

更多关于 nginx php7 mysql 的文章

 

随机推荐