nginx_php_mysql install

阅读更多
基础
yum -y install gcc gcc-c++ make cmake autoconf openssl openssl-devel openssl-clients curl curl-devel wget rsync expect readline readline-devel bison bison-devel  pcre pcre-devel zlib-devel zlib  freetype freetype-devel

nginx php
yum -y install libpng libjpeg libxml2 libxml2-devel libjpeg-devel libpng-devel
yum -y install mysql
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
tar -zxf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure
make -j 8 && make install

x64:
ln -s /usr/lib64/mysql/ /usr/lib/mysql

vi /etc/ld.so.conf
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64

ldconfig

nginx
wget http://nginx.org/download/nginx-1.2.7.tar.gz
tar zxf nginx-1.2.7.tar.gz
cd nginx-1.2.7
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
make -j 8 && make install

php:
wget http://www.php.net/get/php-5.4.13.tar.bz2/from/cn2.php.net/mirror
tar jxf php-5.4.13.tar.bz2
cd php-5.4.13
./configure --prefix=/usr/local/php --with-iconv --with-zlib --enable-xml --disable-rpath --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-mysql --with-mysqli --enable-sqlite-utf8 --with-pdo-mysql --enable-ftp --with-jpeg-dir --with-freetype-dir --with-png-dir --enable-fpm --with-fpm-user=www --with-fpm-group=www
make -j 8 && make install
拷贝和修改php配置文件

# cp php.ini-production /usr/local/php/lib/php.ini 或是/usr/local/lib/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# /usr/local/php/bin/php --ini   //测试ini文件是否加载

vi php.ini
[PHP]
register_globals = Off
magic_quotes_gpc = Off
allow_url_fopen = Off
allow_url_include = Off
expose_php=Off
disable_functions = shell_exec,system,exec,passthru,show_source,curl_exec,curl_multi_exec,get_cfg_var
[Date]
date.timezone = “Asia/Shanghai”

vi php-fpm.conf
[global]
pid = run/php-fpm.pid
error_log = log/php-fpm.log
log_level = notice
emergency_restart_threshold = 0
emergency_restart_interval = 0
[www]
pm.max_children=50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500

添加服务启动脚本,见附件

chmod 755 /etc/init.d/nginx
chmod 755 /etc/init.d/php-fpm
chkconfig --add nginx
chkconfig --add php-fpm
chkconfig nginx on
chkconfig php-fpm on

install mysql
useradd -m mysql
tar -zxf mysql-5.6.10.tar.gz
# 进入解压缩源码目录
cd mysql-5.6.10
# 从mysql5.5起,mysql源码安装开始使用cmake了,执行源码编译配置脚本。
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/home/mysql/data -DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306
make -j 8 && make install
# 复制配置文件
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
# 进入安装路径
cd /usr/local/mysql
# 执行配置脚本
scripts/mysql_install_db --user=mysql --datadir=/home/mysql/data
# 复制服务启动脚本
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
# 启动MySQL服务
service mysqld start
# 设置开机自动启动服务
chkconfig mysqld on
>>>>>>>>>>>>>>>完成
修改MySQL的root用户的密码以及打开远程连接
mysql> use mysql;
mysql> desc user;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "root";    //为root添加远程连接的能力
mysql> update user set Password = password('123456') where User='root';    //设置root用户密码
mysql> select Host,User,Password from user where User='root';
mysql> flush privileges;
mysql> exit
  • nginx_php-fpm.zip (1.7 KB)
  • 下载次数: 5

你可能感兴趣的:(nginx_php_mysql install)