LNMP
1、安装Nginx前的环境。
# yum -y install gcc gcc-c++ pcre-devel zlib-devel openssl-devel
 
2、添加www系统用户,在单机实现LNMP的情况下需要使得php的用户与nginx的用户身份相同。
# groupadd -r www
# useradd -r -g www www
 
3、编译安装Nginx。
# tar axf nginx-1.10.1.tar.gz
# cd nginx-1.10.1
# ./configure --prefix=/usr/local --sbin-path=/usr/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=www --group=www --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/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/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/init.d/nginx
# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: [emerg] mkdir() "/var/tmp/nginx/client" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed
# mkdir /var/tmp/nginx
# nginx -t && service nginx start
 
4、编译安装mysql。
# yum -y remove mysql mysql-server
# rm -rf /etc/my.cnf
# yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ cmake make
# groupadd -r mysql
# useradd -r -g mysql -s /sbin/nologin mysql
# tar xvf mysql-5.6.22.tar.gz
# cd mysql-5.6.22
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DMYSQL_DATADIR=/usr/local/mysql/data -DINSTALL_MANDIR=/usr/share/man -DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DEXTRA_CHARSETS=all -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
# make -j `grep 'processor' /proc/cpuinfo |wc -l`
# make install
# cd /usr/local/mysql
# chown -R mysql:mysql .
# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data
# cp support-files/my-default.cnf /etc/my.cnf
# cp support-files/mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# chkconfig mysqld on
# service mysqld start
# echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
# source /etc/profile
 
5、准备php环境。
# yum -y install bzip2-devel libxml2-devel libcurl-devel freetype-devel libpng-devel libjpeg-devel mysql-devel
 
6、安装libmcrypt-2.5.8.tar.gz。
# tar axf libmcrypt-2.5.8.tar.gz
# ./configure
# make && make install
 
7、安装php。
# cp php-5.5.38.tar.xz /tmp
# xz -d php-5.5.38.tar.xz
# tar axf php-5.5.38.tar
# cd php-5.5.38
# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql/ --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-gd --with-libxml-dir=/usr/ --enable-xml --with-mhash --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 --with-curl --with-fpm-user=www --with-fpm-group=www
此处的mysql如果为编译安装则需要指定当前编译安装的路径。
# make && make install
# cp php.ini-production /etc/php.ini
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chomd +x /etc/init.d/php-fpm
# chkconfig --add php-fpm
# chkconfig php-fpm on
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# service php-fpm start
# ss -tunlp
此处查看9000端口如果已经处于监听状态,则php-fpm已启动。
 
8、配置nginx与php的通信。
# vim /etc/nginx/nginx.conf
location / {
root html;
index index.php index.html index.htm;
}
 
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
指定对于php的文件都发送到本地的9000端口使php进行处理。
# cat /usr/local/html/index.php
<?php
phpinfo();
?>
# service nginx restart
此时通过浏览器访问当前主机的页面即可显示php的相关信息。
 
9、为本地的mysql创建本地用户,使php与mysql建立联系。
# mysql
mysql> DROP USER ''@'localhost';
mysql> UPDATE mysql.user SET Password=PASSWORD('redhat') WHERE user='root';
mysql> FLUSH PRIVILEGES;
 
10、编辑index.php文件。
# vim /usr/local/html/index.php
<?php
$link = mysql_connect('127.0.0.1','root','redhat');
if ($link)
echo "Success...";
else
echo "Failure...";
 
mysql_close();
?>
编辑完成后通过浏览器查看即可。
 
 
 
QQ农场
#pwd
/tmp
#unzip farm-ucenter1.5.zip
#mysql -uroot -predhat
create database farm;
#mysql -uroot -predhat farm <qqfarm.sql
#cd /usr/local
#mv html html.bak
#mkdir html
#cd /tmp/upload
#mv * /usr/local/html
#chmod 777 -R /usr/local/html
#vim /etc/php.ini
:/short
short_open_tag = Off ==>On
#/etc/init.d/php-fpm restart
 
 
 
DNS解析
#yum -y install bind*
#vim /etc/named.conf
listen port 53 { any;}; 修改此行的127.0.0.1为any
allow-query { any;}; 修改此行的localhost为any
zone "ak.com" IN { type master; file "ak.com.zone"; };
#cd /var/named
#cp -p named.localhost ak.com.zone
#chkconfig named on
#cd /var/named
#vim ak.com.zone
$TTL 1D
@ IN SOA master.ak.com root.ak.com. (
2016081101 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS master.ak.com
master.ak.com IN A 192.168.11.6
 
ns1 IN A 192.168.11.6
www IN A 192.168.11.6
 
#/etc/init.d/named restart
#nslookup
server
server 192.168.11.6

LNMP+FARM+DNS的更多相关文章

  1. 安装lnmp一键安装包(转)

    系统需求: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian Linux系统 需要3GB以上硬盘剩余空间 128M以上内存,Xen的需要有SWAP,OpenVZ的另外 ...

  2. 关于轻松安装LNMP和LAMP的编译环境

    http://lnmp.org/install.html 系统需求: CentOS/RHEL/Fedora/Debian/Ubuntu/Raspbian Linux系统 需要2GB以上硬盘剩余空间 1 ...

  3. VPS及LNMP(一)

    1.试用了搬瓦工.interserver.天翼云.网安互联之后,分别写下感受: 前两个是美国服务器,天翼云是国内服务器,网安互联是香港主机. a.搬瓦工非常便宜,512M的1年9.99刀,但是用了之后 ...

  4. 深度优化LNMP

    优化前准备工作 Centos准备及配置 准备安装包及软件:http://pan.baidu.com/s/1chHQF  下载解压到U盘即可安装http://pan.baidu.com/s/15TUWf ...

  5. CentOS 6 lnmp环境脚本

    实验环境:CentOS 6.3 32位 首先我们先去下载nginx的第三方yum源 mkdir /shell cd /shell wget http://www.atomicorp.com/insta ...

  6. 深度优化LNMP之Nginx [2]

    深度优化LNMP之Nginx [2]   配置Nginx gzip 压缩实现性能优化 1.Nginx gzip压缩功能介绍        Nginx gzuo压缩模块提供了压缩文件内容的功能,用户请求 ...

  7. LNMP安装与配置

    Nginx与apache.lighttp性能综合对比,如下图:                           注意:关闭rpm默认安装的apache和mysql 1.准备php函数的rpm包 y ...

  8. CentOS编译安装LNMP环境

    这里是教大家如何在centos下利用源码编译安装LNMP环境. 工具/原料 centos服务器一台 自用电脑一台 准备篇 配置好IP.DNS .网关,确保使用远程连接工具能够连接服务器 配置防火墙,开 ...

  9. CentOS 7 for ARM 安装一键Lnmp失败

    背景 前面把树莓派装上了CentOS 7,趁着国庆放假回来赶紧把服务端环境搭起来,为了方便就准备用一键lnmp快速部署一个,结果死活安装不成功... 报错 按照以往的经验进行安装,在我的小树莓派上安装 ...

随机推荐

  1. UVA - 247 Calling Circles Floyd判圈

    思路:利用的Floyd判圈,如果i能到j,j也能到i说明i和j在同一个圈里.每个人的名字可用map编号.最后DFS打印答案即可. AC代码 #include <cstdio> #inclu ...

  2. scrapy回调函数传递参数

    scrapy.Request 的callback传参的两种方式 1.使用 lambda方式传递参数 def parse(self, response): for sel in response.xpa ...

  3. linux虚拟化概述

    虚拟化硬件虚拟化:一台物理机虚拟出多台逻辑上的计算机cpu,内存可分配给多个虚拟机软件虚拟化:一个LAMP平台支撑多个网站桌面虚拟化...... 虚拟机:通过软件平台模拟出的计算机对最终用户来说,感受 ...

  4. Netty(二):Netty为啥去掉支持AIO?

    匠心零度 转载请注明原创出处,谢谢! 疑惑 我们都知道bio nio 以及nio2(也就是aio),如果不是特别熟悉可以看看我之前写的网络 I/O模型,那么netty为什么还经常看到类似下面的这段代码 ...

  5. vxWorks/BootROM Imageq启动顺序详解

    vxWorks/BootROM Imageq启动顺序详解 VxWorks image     分为在ROM中运行和在RAM中运行两种,两者启动顺序的区别在于sysInit()函数的调用,该函数在RAM ...

  6. windows下使用docker安装tensorflow

    一.安装Docker 1.首先先按照docker,从https://get.daocloud.io/toolbox/  下载exe文件就好 双击安装会多出来三个东西: Oracle VM Virtua ...

  7. Flex和Servlet结合上传文件报错(一)

    1.具体错误如下 一个表单域 不是一个表单域 java.io.FileNotFoundException: D:\MyEclipse\workspace\FlexFileUpload\Web\null ...

  8. WebService之CXF注解之四(测试类)

    TeacherTest.java: /** * @Title:TeacherTest.java * @Package:com.test.service * @Description: * @autho ...

  9. freemarker写select组件报错总结(五)

    1.错误描述 六月 26, 2014 10:44:49 下午 freemarker.log.JDK14LoggerFactory$JDK14Logger error 严重: Template proc ...

  10. Error:dijit.tree.TreeStoreModel:root query returned 0 items

    1.错误描述 error loading root:                                            Tree.js(第341行) Error:dijit.tre ...