CentOS 6.8?nginx 1.9.14?mysql 5.6.23?php 5.6.17
service iptables stop
chkconfig iptables off
setenforce 0
vi /etc/sysconfig/selinux
SELINUX=disabled
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 openldap-clients openldap-servers make libtool* git tree bison pcre-devel perl gd gd-devel
mkdir software
cd software
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz
cd libiconv-1.14/
./configure –prefix=/usr/local
make && make install
wget http://heanet.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
tar -zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make && make install
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fmcrypt%2Ffiles%2FLibmcrypt%2F2.5.8%2F&ts=1468310750&use_mirror=freefr
tar xf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make && make install
cd libltdl/
./configure –enable-ltdl-install
make && make install
wget http://pkgs.fedoraproject.org/repo/pkgs/mcrypt/mcrypt-2.6.8.tar.gz/md5/97639f8821b10f80943fa17da302607e/mcrypt-2.6.8.tar.gz
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8/
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
./configure
make && 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/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
ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config
wget https://cmake.org/files/v3.6/cmake-3.6.0.tar.gz
tar xf cmake-3.6.0.tar.gz
cd cmake-3.6.0
./bootstrap
make && make install
wget http://pkgs.fedoraproject.org/repo/pkgs/community-mysql/mysql-5.6.30.tar.gz/md5/ac8ba1db4454d2c144c7d892185a9328/mysql-5.6.30.tar.gz
tar -xf mysql-5.6.30.tar.gz
groupadd -r mysql
useradd -r -g mysql mysql
mkdir -p /usr/local/mysql
mkdir -p /data/mysqldb
cd mysql-5.6.30
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1-DMYSQL_DATADIR=/data/mysqldb -DMYSQL_TCP_PORT=3306 -DENABLE_DOWNLOADS=1-DSYSCONFDIR=/etc -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0
make&& make install
cd /usr/local/mysql
chown -R mysql:mysql .
cd /data/mysqldb
chown -R mysql:mysql .
vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# CLIENT #
port =3306
socket =/data/mysqldb/mysql.sock
[mysqld]
# GENERAL #
user =mysql
default-storage-engine =InnoDB
socket =/data/mysqldb/mysql.sock
pid-file =/data/mysqldb/mysql.pid
# MyISAM #
key-buffer-size =32M
myisam-recover =FORCE,BACKUP
# SAFETY #
max-allowed-packet =16M
max-connect-errors =1000000
# DATA STORAGE #
datadir =/data/mysqldb/
# BINARY LOGGING #
log-bin =/data/mysqldb/mysql-bin
expire-logs-days =14
sync-binlog =1
# REPLICATION #
skip-slave-start =1
relay-log =/data/mysqldb/relay-bin
slave-net-timeout =60
# CACHES AND LIMITS #
tmp-table-size =32M
max-heap-table-size =32M
query-cache-type =0
query-cache-size =0
max-connections =500
thread-cache-size =50
open-files-limit =65535
table-definition-cache =4096
table-open-cache =4096
# INNODB #
innodb-flush-method =O_DIRECT
innodb-log-files-in-group =2
innodb-log-file-size =64M
innodb-flush-log-at-trx-commit =1
innodb-file-per-table =1
innodb-buffer-pool-size =592M
# LOGGING #
log-error =/data/mysqldb/mysql-error.log
log-queries-not-using-indexes =1
slow-query-log =1
slow-query-log-file =/data/mysqldb/mysql-slow.log
cp support-files/mysql.server /etc/init.d/mysqld
service mysqld start
chkconfig mysqld on
drop user ”@localhost;
drop user ”@hostname;
update mysql.user set password=password(‘*******’);
flush privileges;
wget http://nginx.org/download/nginx-1.9.14.tar.gz
groupadd -r nginx
useradd -g nginx -r nginx
mkdir -pv /var/tmp/nginx/client
nginx
tar xf nginx-1.9.14.tar.gz
cd nginx-1.9.14
./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 –lock-path=/var/lock/nginx.lock –user=nginx –group=nginx –with-http_ssl_module –with-http_flv_module –with-http_stub_status_module –with-http_gzip_static_module –http-client-body-temp-path=/var/tmp/nginx/client/ –http-proxy-temp-path=/var/tmp/nginx/proxy/ –http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ –http-uwsgi-temp-path=/var/tmp/nginx/uwsgi –http-scgi-temp-path=/var/tmp/nginx/scgi –with-pcre
make && make install
vim /etc/rc.d/init.d/nginx
#!/bin/sh
#
# nginx – this script starts and stops the nginx daemon
#
# chkconfig: – 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
# pidfile: /var/run/nginx.pid
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ “$NETWORKING” = “no” ] && exit 0
nginx=”/usr/local/nginx/sbin/nginx”
prog=$(basename $nginx)
NGINX_CONF_FILE=”/etc/nginx/nginx.conf”
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
lockfile=/var/lock/subsys/nginx
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 $options; 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
fi
fi
done
}
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
make_dirs
echo -n $”Starting $prog: ”
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $”Stopping $prog: ”
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
sleep 1
start
}
reload() {
configtest || return $?
echo -n $”Reloading $prog: ”
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case “$1″ in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $”Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}”
exit 2
esac
chmod +x /etc/rc.d/init.d/nginx
chkconfig –add nginx
chkconfig nginx on
service nginx start
?PHP
p
cp -frp /usr/lib64/libldap* /usr/lib/
echo /usr/local/mysql/lib >> /etc/ld.so.conf.d/mysql-x86_64.conf
ldconfig -v
php
tar xf php-5.6.17.tar.gz
cd php-5.6.17
./configure –prefix=/usr/local/php –with-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-iconv-dir=/usr/local –with-openssl –enable-mbstring –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –enable-mbregex –enable-mbstring –with-gd –enable-gd-native-ttf –with-mhash –enable-pcntl –enable-sockets –with-mcrypt –with-ldap –with-ldap-sasl–with-xmlrpc –enable-zip –enable-soap –with-bz2 –with-config-file-path=/etc –enable-fpm –with-config-file-scan-dir=/etc/php.d –enable-maintainer-zts
make ZEND_EXTRA_LIBS=’-liconv’
make install
PHP
cp php.ini-production /etc/php.ini
php-fpm
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
php-fpm
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig –add php-fpm
chkconfig php-fpm on
service php-fpm start
web
nginx,php
vim /etc/nginx/nginx.conf
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
#???
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
LNMP
vim /usr/local/nginx/html/test.php
nginx
service nginx reload
http://ip/test.php,LNMP
Recent Comments