CentOS-6.5安装配置Tengine

阅读:452 2019-03-19 14:41:44 来源:新网

cd/usr/local/srcwgethttp://downloads.sourceforge.net/project/pcre/pcre/8.37/pcre-8.37.tar.gztarzxvfpcre-8.37.tar.gzcdpcre-8.37./configure--prefix=/usr/local/pcremakemakeinstall二、下载proxy_cache插件

cd/usr/local/srcwgethttp://labs.frickle.com/files/ngx_cache_purge-2.3.tar.gztarzxvfngx_cache_purge-2.3.tar.gz三、安装tengine

yuminstallopensslopenssl-devel-y

cd/usr/local/srcwgethttp://tengine.taobao.org/download/tengine-2.1.0.tar.gztarzxvftengine-2.1.0.tar.gzcdtengine-2.1.0./configure--add-module=/usr/local/src/ngx_cache_purge-2.3--prefix=/usr/local/nginx--with-http_stub_status_module--with-pcre=/usr/local/src/pcre-8.37makemakeinstall

/usr/local/nginx/sbin/nginx#启动nginxchownnobody.nobody-r/usr/local/nginx/htmlchmod700-r/usr/local/nginx/html

如果编译的问题的话,看看是不是下面的原因:

./configure:error:thehttpsslmodulerequiresopenssllibrary原因:安装http_ssl_module模块需要openssllibrary解决:yuminstallopenssl-devel./configure:error:thehttprewritemodulerequiresthepcrelibrary.原因:安装http_rewrite_module模块需要先安装pcre开发包解决:yuminstallpcre-devel

注意:

--with-pcre=/usr/local/src/pcre-8.37指向的是源码包解压的路径,而不是安装的路径,否则会报错。

--add-module=/usr/local/src/ngx_cache_purge-2.3是指加载缓存的插件模块

vi/etc/rc.d/init.d/nginx#编辑启动文件添加下面内容

#!/bin/bash#tenginestartupscript#processname:nginx#chkconfig:-8515#description:nginxisaworldwidewebserver.itisusedtoserve#pidfile:/var/run/nginx.pid#config:/usr/local/nginx/conf/nginx.confnginxd=/usr/local/nginx/sbin/nginxnginx_config=/usr/local/nginx/conf/nginx.confnginx_pid=/usr/local/nginx/logs/nginx.pidretval=0prog="nginx"#sourcefunctionlibrary../etc/rc.d/init.d/functions#sourcenetworkingconfiguration../etc/sysconfig/network#checkthatnetworkingisup.[${networking}="no"]&&exit0[-x$nginxd]||exit0#startnginxdaemonsfunctions.start(){if[-e$nginx_pid];thenecho"tenginealreadyrunning...."exit1fiecho-n$"starting$prog:"daemon$nginxd-c${nginx_config}retval=$?echo[$retval=0]&&touch/var/lock/subsys/nginxreturn$retval}#stopnginxdaemonsfunctions.stop(){echo-n$"stopping$prog:"killproc$nginxdretval=$?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-hupretval=$?echo}#seehowwewerecalled.case"$1"instart)start;;stop)stop;;reload)reload;;restart)stopstart;;status)status$progretval=$?;;*)echo$"usage:$prog{start|stop|restart|reload|status|help}"exit1esacexit$retval

保存退出

chmod775/etc/rc.d/init.d/nginx#赋予文件执行权限chkconfig--level012345nginxon#设置开机启动/etc/rc.d/init.d/nginxrestart五、配置tengine将nginx初始配置文件备份,我们要重新创建配置文件.

mv/usr/local/nginx/conf/nginx.conf/usr/local/nginx/conf/nginx.conf.bak

创建nginx用户nginx

groupaddnginxuseradd-gnginxnginx

编辑主配置文件:

相关文章
{{ v.title }}
{{ v.description||(cleanHtml(v.content)).substr(0,100)+'···' }}
你可能感兴趣
推荐阅读 更多>
推荐商标

{{ v.name }}

{{ v.cls }}类

立即购买 联系客服