centos nginx php mysql

  1 #yum install firewalld  //安装firewalld 防火墙
  2 #开启服务 
  3 # systemctl start firewalld.service
  4 #关闭防火墙
  5 systemctl stop firewalld.service
  6 #开机自动启动
  7 # systemctl enable firewalld.service
  8 #关闭开机制动启动
  9 systemctl disable firewalld.service
 10 #查看状态
 11 #systemctl status firewalld
 12 
 13 hostname -f
 14 
 15 [ -s /etc/selinux/config ] && sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config && /usr/sbin/setenforce 0
 16 getenforce
 17 
 18 vi /etc/yum.repos.d/nginx.repo
 19 [nginx]
 20 name=nginx repo
 21 baseurl=http://nginx.org/packages/centos/7/$basearch/
 22 gpgcheck=0
 23 enabled=1
 24 
 25 #rpm -ivh https://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
 26 #rpm -ivh http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-common-5.5.54-2.el7.x86_64.rpm
 27 
 28 #yum update -y
 29 
 30 yum install -y nginx sendmail net-tools wget unzip vim-enhanced crontabs autoconf gcc gcc-c++ make cmake ncurses-devel libxml2-devel openldap-devel libjpeg-devel libpng-devel freetype-devel openssl-devel bzip2-devel curl-devel pcre-devel logwatch
 31 【mysql】
 32 rpm -e postfix
 33 rpm -e mariadb-libs
 34 #rpm -e mariadb-devel
 35 wget http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-client-5.5.54-2.el7.x86_64.rpm
 36 wget http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-common-5.5.54-2.el7.x86_64.rpm
 37 wget http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-devel-5.5.54-2.el7.x86_64.rpm
 38 wget http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-libs-5.5.54-2.el7.x86_64.rpm
 39 wget http://repo.mysql.com/yum/mysql-5.5-community/el/7/x86_64/mysql-community-server-5.5.54-2.el7.x86_64.rpm
 40 rpm -ivh mysql-community-common-5.5.54-2.el7.x86_64.rpm
 41 rpm -ivh mysql-community-libs-5.5.54-2.el7.x86_64.rpm
 42 rpm -ivh mysql-community-client-5.5.54-2.el7.x86_64.rpm
 43 rpm -ivh mysql-community-devel-5.5.54-2.el7.x86_64.rpm
 44 yum install -y perl-DBD-MySQL libaio
 45 rpm -ivh mysql-community-server-5.5.54-2.el7.x86_64.rpm
 46 
 47 #yum install mysql-server mysql-devel -y
 48 echo "expire_logs_days = 30" >> /etc/my.cnf
 49 systemctl start mysqld
 50 mysql_secure_installation
 51 chkconfig mysqld on
 52 【mcrypt】
 53 wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
 54 tar zxf libmcrypt-2.5.8.tar.gz
 55 cd libmcrypt-2.5.8
 56 ./configure
 57 make
 58 make install
 59 cd libltdl
 60 ./configure --enable-ltdl-install
 61 make
 62 make install
 63 cd
 64 
 65 【PHP】
 66 wget http://mirrors.sohu.com/php/php-5.3.29.tar.gz
 67 tar zxf php-5.3.29.tar.gz
 68 cd php-5.3.29
 69 export LIBRARY_PATH=/usr/lib64/mysql
 70 ln -s /usr/lib64/mysql/libmysqlclient* /usr/lib
 71 ./configure --enable-fpm --enable-zip --enable-exif --enable-bcmath --enable-sockets --enable-wddx --enable-mbstring --enable-shmop --enable-soap --enable-ftp --enable-calendar --enable-gd-native-ttf --enable-gd-jis-conv --with-fpm-user=nginx --with-fpm-group=nginx --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-zlib --with-gettext --with-mhash --with-bz2 --with-curl --with-gettext --with-openssl --with-xmlrpc --with-kerberos --with-mcrypt --without-pear --with-mysqli=/usr/bin/mysql_config --with-mysql-sock=/var/lib/mysql/mysql.sock --with-mysql=/usr --with-pdo-mysql=/usr
 72 # --enable-opcache
 73 make
 74 make install
 75 cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf
 76 cp php.ini-production /usr/local/lib/php.ini
 77 
 78 #sed -i "s/^;pid/pid/" /usr/local/etc/php-fpm.conf
 79 #sed -i "s#^;error_log =.*#error_log = /var/log/php-fpm.log#" /usr/local/etc/php-fpm.conf
 80 #sed -i "s/www@my.domain.com/cto@pinyu.tv/" /usr/local/etc/php-fpm.conf
 81 ##sed -i "s@^listen = 127.0.0.1:9000@listen = /tmp/php-cgi.sock@" /usr/local/etc/php-fpm.conf
 82 #sed -i "s/^;listen.owner.*/listen.owner = nginx/" /usr/local/etc/php-fpm.conf
 83 #sed -i 's@^memory_limit =.*@memory_limit = 110M@' /usr/local/lib/php.ini
 84 #sed -i "s/^post_max_size =.*/post_max_size = 20M/" /usr/local/lib/php.ini
 85 #sed -i "s/^upload_max_filesize =.*/upload_max_filesize = 20M/" /usr/local/lib/php.ini
 86 sed -i "s/^;date.timezone =.*/date.timezone = PRC/" /usr/local/lib/php.ini
 87 sed -i "s/^short_open_tag = Off/short_open_tag = On/" /usr/local/lib/php.ini
 88 sed -i "s/localhost/cto@pinyu.tv/" /usr/local/lib/php.ini
 89 #sed -i "s/^max_execution_time =.*/max_execution_time = 100/" /usr/local/lib/php.ini
 90 sed -i 's/^;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/' /usr/local/lib/php.ini
 91 sed -i 's/^disable_functions =/disable_functions = passthru,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g' /usr/local/lib/php.ini
 92 #sed -i "s/^output_buffering = /;output_buffering = /" /usr/local/lib/php.ini
 93 #sed -i "s/^expose_php = On/expose_php = Off/" /usr/local/lib/php.ini
 94 #sed -i "s/^request_order =.*/request_order = \"CGP\"/" /usr/local/lib/php.ini
 95 sed -i "s/^magic_quotes_gpc =.*/magic_quotes_gpc = On/" /usr/local/lib/php.ini
 96 wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
 97 tar zxf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
 98 cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/local/lib/php/build/
 99 echo 'zend_extension=/usr/local/lib/php/build/ZendGuardLoader.so
100 zend_loader.enable=1
101 zend_loader.disable_licensing=0
102 zend_loader.obfuscation_level_support=3'>> /usr/local/lib/php.ini
103 /usr/local/sbin/php-fpm -t
104 cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
105 chmod +x /etc/rc.d/init.d/php-fpm
106 service php-fpm start
107 chkconfig php-fpm on
108 #systemctl enable php-fpm.service
109 重启
110 kill -USR2 `cat /usr/local/var/run/php-fpm.pid`
111 关闭
112 kill -INT `cat /usr/local/var/run/php-fpm.pid`
113 
114 #/usr/local/bin/php-config
115 
116 【nginx】
117 #yum install nginx -y
118 mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf_bak
119 sed -i -e "1a fastcgi_param  SCRIPT_FILENAME    \$document_root\$fastcgi_script_name;" /etc/nginx/fastcgi_params
120 wget https://files.cnblogs.com/files/lotro/NginxOptimize.tar.gz
121 tar zxf NginxOptimize.tar.gz -C /etc/nginx/conf.d/
122 wget https://files.cnblogs.com/files/lotro/tz.zip
123 unzip tz.zip -d /home/wwwroot/default
124 wget https://files.cnblogs.com/files/lotro/rewrite.zip
125 unzip rewrite.zip -d /etc/nginx/
126 service nginx start
127 chkconfig nginx on
128 wget https://files.cnblogs.com/files/lotro/home.tar.gz
129 tar zxf home.tar.gz -C /home/wwwroot
130 #find html/ -name *.* -exec chmod -x {} \;

 

posted on 2017-02-27 03:22  Sh0w1ov3  阅读(258)  评论(0)    收藏  举报