最近帮客户写一个文档,客户要求照着文档敲能够完成整个lnmp部署,特记录下来!
#cd /opt/ wget http://nginx.org/download/nginx-1.12.2.tar.gz #tar -xvf nginx-1.12.2.tar.gz #cd nginx-1.12.2 #./configure --prefix=/usr/local/nginx --sbin-path=/usr/sbin/nginx --user=www --group=www --with-http_ssl_module --with-http_gzip_static_module --with-http_stub_status_module #make && make install
#! /bin/bash
# chkconfig: 35 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="nginx daemon"
NAME=nginx
DAEMON=/usr/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
test -x $DAEMON || exit 0
d_start(){
$DAEMON || echo -n " already running"
}
d_stop() {
$DAEMON -s quit || echo -n " not running"
}
d_reload() {
$DAEMON -s reload || echo -n " counld not reload"
}
case "$1" in
start)
echo -n "Starting $DESC:$NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC:$NAME"
d_stop
echo "."
;;
reload)
echo -n "Reloading $DESC configuration..."
d_reload
echo "reloaded."
;;
restart)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 2
d_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|reload}" >&2
exit 3
;;
esac
exit 0
(3)安装配置php
#cd /opt/ #wget http://am1.php.net/distributions/php-7.1.1.tar.gz #tar zvxf php-7.1.1.tar.gz #export LD_LIBRARY_PATH=/lib/:/usr/lib/:/usr/local/lib #cd php-7.1.1 ./configure \ --prefix=/usr/local/php \ --with-config-file-path=/etc \ --enable-fpm \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-inline-optimization \ --disable-debug \ --disable-rpath \ --enable-shared \ --enable-soap \ --with-libxml-dir \ --with-xmlrpc \ --with-openssl \ --with-mcrypt \ --with-mhash \ --with-pcre-regex \ --with-sqlite3 \ --with-zlib \ --enable-bcmath \ --with-iconv \ --with-bz2 \ --enable-calendar \ --with-curl \ --with-cdb \ --enable-dom \ --enable-exif \ --enable-fileinfo \ --enable-filter \ --with-pcre-dir \ --enable-ftp \ --with-gd \ --with-openssl-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib-dir \ --with-freetype-dir \ --enable-gd-native-ttf \ --enable-gd-jis-conv \ --with-gettext \ --with-gmp \ --with-mhash \ --enable-json \ --enable-mbstring \ --enable-mbregex \ --enable-mbregex-backtrack \ --with-libmbfl \ --with-onig \ --enable-pdo \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-zlib-dir \ --with-pdo-sqlite \ --with-readline \ --enable-session \ --enable-shmop \ --enable-simplexml \ --enable-sockets \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --enable-wddx \ --with-libxml-dir \ --with-xsl \ --enable-zip \ --enable-mysqlnd-compression-support \ --with-pear \ --enable-opcache
vi /usr/local/nginx/conf/nginx.conf
location ~ \.php$ {
root /usr/local/nginx/html/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
}注释:/usr/local/nginx/html/ nginx的web目录
server {
listen 80;
server_name web.test.com;
location ~ \.php$ {
root /usr/local/nginx/html/web.test.com;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params
}
location / {
root /usr/local/nginx/html/web.test.com;
index index.php;
}
}
(6)MySQL5.6安装配置
#cd /opt #yum -y install libaio libaio-devel #wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz #groupadd mysql #useradd -r -g mysql -s /bin/false mysql #tar -xvf mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz # cd mysql-5.6.35-linux-glibc2.5-x86_64 #mv mysql-5.6.35-linux-glibc2.5-x86_64 /usr/local/mysql #chown -R mysql:mysql /usr/local/mysql #rm -rf /etc/my.cnf #cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf 修改文件为 [mysqld] basedir=/usr/local/mysql datadir=/usr/local/mysql/data pid-file=/usr/local/mysql/mysql.pid log-error=/usr/local/mysql/data/mysql.err max_connections=200 default-storage-engine=INNODB lower_case_table_names=1 max_allowed_packet=20M 初始化数据库 #cd /usr/local/mysql/scripts # ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data # cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld 启动数据库 # service mysqld start 添加环境变量 #echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile #source /etc/profile #原数据库面位为空 修改数据库密码为admin123@ mysqladmin -uroot password admin123@
#cd /opt/
#wget
http://download.redis.io/releases/redis-4.0.9.tar.gz#tar -xvf redis-4.0.9.tar.gz
#cd redis-4.0.9
#make
#make install
#cp redis.conf /etc/
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.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
redis="/usr/local/bin/redis-server"
prog=$(basename $redis)
REDIS_CONF_FILE="/etc/redis.conf"
[ -f /etc/sysconfig/redis ] && . /etc/sysconfig/redis
lockfile=/var/lock/subsys/redis
start() {
[ -x $redis ] || exit 5
[ -f $REDIS_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $redis $REDIS_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() {
stop
start
}
reload() {
echo -n $"Reloading $prog: "
killproc $redis -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
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}"
exit 2
esac
#yum install gcc libevent libevent-devel #wget #tar -xvf memcached-1.5.7.tar.gz #cd memcached-1.5.7 #/configure --prefix=/usr/local/memcached && make && sudo make install 启动服务 /usr/local/memcached/bin/memcached -d -u root -l 172.16.177.69 -p 11211 -m 10 -c 1000 -P /tmp/memcached.pid
#wget https://files.phpmyadmin.net/phpMyAdmin/4.7.0/phpMyAdmin-4.7.0-all-languages.tar.gz #tar -xvf phpMyAdmin-4.7.0-all-languages.tar.gz #mv phpMyAdmin-4.7.0-all-languages /usr/local/nginx/html/phpMyAdmin
转载请注明:IT笔记分享 » WEB运维 » LNMP编译安装部署文档
版权声明
本站《作品展示》类文章均为原创,转载必须注明出处,技术分享类文章部分来源于网络,版权归原作者所有,若侵权请留言。















