tengine + mysql + nginx + php
tengine + mysql + nginx + php
1、配置防火墙
vim /etc/sysconfig/iptables
# 允许80端口通过防火墙
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
# 允许3306端口通过防火墙
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
# 允许21端口通过防火墙
-A INPUT -p tcp -m state -m tcp --dport 21 --state NEW -j ACCEPT
# 禁用ping
-A INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP
备注:
添加配置需要防止于commit代码之间
重新启动:
/etc/init.d/iptables restart
2、安装tengine
2.1 更新 yum
yum update
2.2 删除系统自带的软件包
yum remove httpd* php*
编译库
yum install gcc-c++
安装依赖库
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
安装ngx_cache_purge模块
cd /usr/local
wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
tar -zxvf ngx_cache_purge-2.1.tar.gz
rm -rf ngx_cache_purge-2.1.tar.gz
# 下载Tengine
cd /usr/local/lib
wget http://tengine.taobao.org/download/tengine-2.0.3.tar.gz
# 解压,重命名,删除tengine包
tar -zxvf tengine-2.0.3.tar.gz && rm -rf tengine-2.0.3.tar.gz
安装Tengine
cd tengine-2.0.3 && ./configure --add-module=/usr/local/ngx_cache_purge-2.1 --with-http_stub_status_module --prefix=/usr/local/nginx --user=nginx --group=nginx && make && make install
设置开机启动
vi /etc/rc.d/init.d/nginx
编辑启动文件添加下面内容
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
# It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /var/run/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
echo "nginx already running...."
exit 1
fi
echo -n $"Starting $prog: "
daemon $nginxd -c ${nginx_config}
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
return $RETVAL
}
# Stop nginx daemons functions.
stop() {
echo -n $"Stopping $prog: "
killproc $nginxd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
reload() {
echo -n $"Reloading $prog: "
#kill -HUP `cat ${nginx_pid}`
killproc $nginxd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
stop
start
;;
status)
status $prog
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|reload|status|help}"
exit 1
esac
exit $RETVAL
#赋执行权限
chmod 775 /etc/rc.d/init.d/nginx
#设置开机启动
chkconfig --level 012345 nginx on
添加用户,组
/usr/sbin/groupadd -f nginx
/usr/sbin/useradd -g nginx nginx
/*
执行启动报错
[root@sz-pc182 tengine-2.0.3]# /etc/rc.d/init.d/nginx restart
Stopping nginx: [FAILED]
Starting nginx: nginx: [emerg] getpwnam("nginx") failed
[FAILED]
解决:
/usr/sbin/groupadd -f nginx
/usr/sbin/useradd -g nginx nginx
*/
3、mysql安装
安装
yum install mysql mysql-server
启动
/etc/init.d/mysqld start
设置开机启动
chkconfig mysqld on
4、安装PHP5
# 根据提示输入Y直到安装完成
yum install php php-fpm
# 这里选择以上安装包进行安装,根据提示输入Y回车
yum install php-mysql php-gd libjpeg* php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath php-mhash libmcrypt
# 设置php-fpm开机启动
chkconfig php-fpm on
# 启动php-fpm (restart:重启, stop:停止, start:启动)
/etc/init.d/php-fpm (restart|stop|start)
service php-fpm (restart|stop|start)
5、配置nginx支持php
修改nginx 配置
vi /usr/local/nginx/conf/nginx.conf
去除
去除php前配置
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /www/php$fastcgi_script_name;
include fastcgi_params;
}
同时修改 fastcgi_param 路径 ,将该路径指向PHP 文件目录
新建php文件
<?php phpinfo()?>
重新启动 nginx
配置完成
参考http://www.cnblogs.com/hzh1990/p/3570453.html
tengine + mysql + nginx + php的更多相关文章
- centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记
centos 6.5下安装mysql+nginx+redmine 3.1.0 笔记 目录[-] 过程 1.安装RVM 2.利用rvm安装 Ruby 1.9.3 并设为默认 3.安装rails 4.安装 ...
- 使用Tengine替代Nginx作为负载均衡服务器
Tengine是由淘宝网发起的Web服务器项目.它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性.Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检 ...
- 转:使用Tengine替代Nginx作为负载均衡服务器
原文来自于:http://heylinux.com/archives/2938.html Tengine是由淘宝网发起的Web服务器项目.它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级 ...
- centos6.5+Django+mysql+nginx+uwsgi
centos6.5+Django+mysql+nginx+uwsgi 1.nginx的安装.这里采用nginx-1.6.0, 建立一个shell脚本然后执行. #!/bin/bash nginx_ve ...
- .NET Core+MySql+Nginx 容器化部署
.NET Core容器化@Docker .NET Core容器化之多容器应用部署@Docker-Compose .NET Core+MySql+Nginx 容器化部署 GitHub-Demo:Dock ...
- 原lnmp环境服务器升级为mysql+nginx+php单个docker容器构建的lnmp环境
时间:2018年2月 一.项目背景 我单位现web服务架构为lnmp环境,服务器软件.硬件升级部署难:同时开源软件日新月异,考虑到技术升级,领导决定服务器架构整体升级为容器架构,维护性.移植性强. 二 ...
- CentOS7 + Python3 + Django(rest_framework) + MySQL + nginx + uwsgi 部署 API 开发环境, 记坑篇
CentOS7 + Python3 + Django(rest_framework) + MySQL + nginx + uwsgi 部署 API 开发环境 CentOS7 + Python3 + D ...
- NET Core+MySql+Nginx
NET Core+MySql+Nginx 容器化部署 .NET Core容器化@Docker.NET Core容器化之多容器应用部署@Docker-Compose.NET Core+MySql+Ngi ...
- linux ( CentOS 7)下Tengine(nginx)的安装与配置
TengineTengine是由淘宝网发起的Web服务器项目.它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性.它的目的是打造一个高效.安全的Web平台. 使用root用户安装 ...
随机推荐
- [游戏模版21] Win32 物理引擎 能量守恒
>_<:Only a little change in the function of MyPaint(...),besides the initial value have some c ...
- [BTS] SQL Adapter. New transaction cannot enlist in the specified transaction coordinator
The adapter "SQL" raised an error message. Details "New transaction cannot enlist in ...
- windows下python检查文件是否被其它文件打开.md
有时候我们需要能够判断一个文件是否正在被其它文件访问,几乎不可避免的要调用操作系统接口 from ctypes import cdll import os _sopen = cdll.msvcrt._ ...
- Kafka重复消费和丢失数据研究
Kafka重复消费原因 底层根本原因:已经消费了数据,但是offset没提交. 原因1:强行kill线程,导致消费后的数据,offset没有提交. 原因2:设置offset为自动提交,关闭kafka时 ...
- Rails下cloud datastore的使用
Rails下cloud datastore的使用 背景 部门有一个项目要用Ruby做 WebAPI,DB使用关系型数据库Cloud Sql和非关系型数据库Cloud Datastore . 还不了 ...
- iOS开发——高级技术&蓝牙服务
蓝牙服务 蓝牙 随着蓝牙低功耗技术BLE(Bluetooth Low Energy)的发展,蓝牙技术正在一步步成熟,如今的大部分移动设备都配备有蓝牙4.0,相比之前的蓝牙技术耗电量大大降低.从iOS的 ...
- javascript设计模式与开发实践阅读笔记(4)——单例模式
定义 单例模式:保证一个类仅有一个实例,并提供一个访问它的全局访问点. 具体来说,就是保证有些对象有且只有一个,比如线程池.全局缓存.浏览器中的window 对象等.在js中单例模式用途很广,比如登录 ...
- Windows Server 2016 桌面环境的自动配置脚本
除非学习要求,还是建议使用Windows 10 LTSB 2016或其他桌面系统. github:https://github.com/m2nlight/WindowsServerToWindowsD ...
- 运用Mono.Ceci类库修改.NET程序集 走上破解软件的道路
代码注入在C++时代很流行,主要是对现有的程序做一些修改,以达到预期的目的.一部分的破解程序,注册机也是借助于此方法,让被注入的程序绕过验证,达到破解的目录.在.NET中,借助于Mono.Cecil程 ...
- [原创]推荐一款强大的.NET程序内存分析工具.NET Memory Profiler
[原创]推荐一款强大的.NET程序内存分析工具.NET Memory Profiler 1 官方网站:http://memprofiler.com/2 下载地址:http://memprofiler. ...