#mysql
yum -y install make gcc gcc-c++ cmake bison bison-devel \
ncurses-devel kernel kernel-devel readline-devel pcre-devel \
openssl openssl-devel perl perl-devel
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.22.tar.gz
tar -zxvf mysql-5.6.22.tar.gz
cd mysql-5.6.22
groupadd mysql
useradd -g mysql mysql
mkdir -p /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
mkdir -p /data/logs
touch /data/logs/mysqld.log
chown -R mysql:mysql /data/logs/mysqld.log
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql/ \
-DSYSCONFDIR=/etc \
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install
cd /usr/local/mysql/scripts
./mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql/ --user=mysql
vim /etc/my.cnf
[client]
port=3306
socket=/data/mysql/mysql.sock
[mysqld]
datadir=/data/mysql
socket=/data/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/data/logs/mysqld.log
pid-file=/data/logs/mysqld.pid
cp ../support-files/mysql.server /etc/init.d/mysqld
chkconfig mysqld on
service mysqld start
vim /etc/profile
PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
delete from mysql.user where user="";
update mysql.user set password=PASSWORD("你的密碼") where user="root";
FLUSH PRIVILEGES;
exit;
#nginx
./configure --prefix=/usr/local/nginx \
--error-log-path=/data/logs/nginx-error.log \
--http-log-path=/data/logs/nginx-access.log \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_stub_status_module
make && make install
# 配置解析php
vim /usr/local/nginx/conf/nginx.conf
location / {
root html;
index index.html index.htm;
}
#加index.php
#找到這個,在後面添加如下
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
vim /usr/local/nginx/html/1.php
#增加
<?php
phpinfo();
?>
#測試: curl localhost/1.php
#nginx啓動腳本和配置文件
vim /etc/init.d/nginx //加入如下內容
#!/bin/bash
# chkconfig: - 30 21
# description: http service.
# Source Function Li11brary
. /etc/init.d/functions
# Nginx Settings
NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog="Nginx"
start() {
echo -n $"Starting $prog: "
mkdir -p /dev/shm/nginx_temp
daemon $NGINX_SBIN -c $NGINX_CONF
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -TERM
rm -rf /dev/shm/nginx_temp
RETVAL=$?
echo
return $RETVAL
}
reload(){
echo -n $"Reloading $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
configtest(){
$NGINX_SBIN -c $NGINX_CONF -t
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
configtest)
configtest
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|configtest}"
RETVAL=1
esac
exit $RETVAL
#保存後,執行
chmod a+x /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
service nginx start
#php
yum install -y epel-release
yum install -y libxml2-devel openssl openssl-devel bzip2 bzip2-devel libpng libpng-devel freetype freetype-devel libmcrypt-devel libjpeg-devel libcurl-devel
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-bz2 --with-curl --enable-ftp --enable-sockets \
--disable-ipv6 --with-gd --with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local --with-freetype-dir=/usr/local \
--enable-gd-native-ttf --with-iconv-dir=/usr/local \
--enable-mbstring --enable-calendar --with-gettext \
--with-libxml-dir=/usr/local --with-zlib \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--enable-dom --enable-xml --enable-fpm \
--enable-bcmath --with-pear
make
make install
cp php.ini-production /usr/local/php/etc/php.ini
cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
service php-fpm start
chkconfig php-fpm on
#檢測是否啓動:ps aux |grep php-fpm
#查看監聽端口:netstat -lnp
iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT
service iptables save
#安裝 wordpress
mysql> create database wordpress character set utf8;
mysql> grant all privileges on wordpress.* to wordpress@localhost identified by "wordpress";
mysql> flush privileges;