一、安装lua模块
查看tenginv 有无安装lua模块 ,如果没有,请查看Nginx安装lua-nginx-module模块详解
二、下载verynginx源码
git clone https://github.com/alexazhou/VeryNginx.git
根据自己配置需要,将目录自己tengine配置目录下面
cp -r * /root/VeryNginx/verynginx/* /usr/local/webserver/nginx/conf
三、修改tengine配置文件中的nginx.conf
新增两条,注意修改的位置
include /usr/local/webserver/nginx/conf/verynginx/nginx_conf/in_external.conf; 全局配置上
include /usr/local/webserver/nginx/conf/verynginx/nginx_conf/in_http_block.conf; http配置里面
#下面这条是配置在dashboard界面上和需要的vhosts上
include /usr/local/webserver/nginx/conf/verynginx/nginx_conf/in_server_block.conf; server 配置里面
测试只要在dashboard上的vhosts添加 ,所以有vhosts都会生效 ,如果不行,单独添加
5 .添加dashboard管理界面vhosts
server {
listen 80;
listen 443;
#this line shoud be include in every http block
include /usr/local/webserver/nginx/conf/verynginx/nginx_conf/in_server_block.conf;
server_name verynginx.xxxxxxxx.com;
root /usr/local/webserver/nginx/conf/verynginx/dashboard;
index index.html index.htm index.php;
access_log /data0/logs/verynginx.log;
}
注意:输入地址 ,有可能会报错 ,正常是http://xx.xxx.com/verynginx/# ,如果不行的话,清空目录下configs/config.json ,账号密码是verynginx:verynginx
特别注意 ,因为改了verynginx默认的路径,所以有一些*.lua里面的路径也要跟着改
nginx_conf/in_http_block.conf: balancer_by_lua_file /usr/local/webserver/nginx/conf/verynginx/lua_script/on_banlance.lua;
nginx_conf/in_http_block.conf:lua_package_path ‘/usr/local/webserver/nginx/conf/verynginx/lua_script/?.lua;;/usr/local/webserver/nginx/conf/verynginx/lua_script/module/?.lua;;’;
nginx_conf/in_http_block.conf:lua_package_cpath ‘/usr/local/webserver/nginx/conf/verynginx/lua_script/?.so;;’;
nginx_conf/in_http_block.conf:init_by_lua_file /usr/local/webserver/nginx/conf/verynginx/lua_script/on_init.lua;
nginx_conf/in_http_block.conf:rewrite_by_lua_file /usr/local/webserver/nginx/conf/verynginx/lua_script/on_rewrite.lua;
nginx_conf/in_http_block.conf:access_by_lua_file /usr/local/webserver/nginx/conf/verynginx/lua_script/on_access.lua;
nginx_conf/in_http_block.conf:log_by_lua_file /usr/local/webserver/nginx/conf/verynginx/lua_script/on_log.lua;
不然nginx -t 会报错 ,切记 。