首页 > 其他分享 >Tengine安装

Tengine安装

时间:2023-12-26 14:44:56浏览次数:40  
标签:etc RETVAL nginx init systemctl Tengine rc 安装

Tengine安装

安装依赖

yum -y install gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre pcre-devel

下载地址

https://tengine.taobao.org/download.html

安装

tar -zxvf tengine-2.2.2.tar.gz
cd tengine-2.2.2
./configure  --prefix=/usr/local/tengine
make && make install

配置成service服务

vi /etc/rc.d/init.d/ngin # 将下述文件样例填入并保存

chmod 775 /etc/rc.d/init.d/ngin
# 测试
/etc/rc.d/init.d/ngin start
/etc/rc.d/init.d/ngin restart
/etc/rc.d/init.d/ngin stop

文件样例

#!/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
nginx_home=/usr/local/tengine     #Tengine安装目录
nginxd=$nginx_home/sbin/nginx
nginx_config=$nginx_home/conf/nginx.conf
nginx_pid=$nginx_home/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 $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

配置systemd服务

vi /etc/systemd/system/nginx.service # 将下述文件样例填入并保存
sudo systemctl daemon-reload # 重新加载 systemd 配置
# 测试
systemctl status nginx
systemctl start nginx
systemctl status nginx
systemctl restart nginx
systemctl status nginx
systemctl stop nginx
systemctl status nginx

nginx.service样例

[Unit]
Description=nginx - high-performance web server
After=network.target

[Service]
Type=forking
ExecStart=/etc/rc.d/init.d/nginx start
ExecStop=/etc/rc.d/init.d/nginx stop
ExecReload=/etc/rc.d/init.d/nginx reload
ExecStartPost=/bin/sleep 1 # 在systemctl报pid找不到错误时可添加此句1秒后再检测服务是否启动正常

[Install]
WantedBy=multi-user.target

标签:etc,RETVAL,nginx,init,systemctl,Tengine,rc,安装
From: https://www.cnblogs.com/zdtiio/p/17928062.html

相关文章

  • Nginx安装部署
    如果没有gcc环境,需要安装gcc:yuminstallgcc-c++安装依赖yum-yinstallgcczlibzlib-develpcre-developensslopenssl-devel#进入文件夹cd/usr/local#下载安装包wgethttp://nginx.org/download/nginx-1.18.0.tar.gz#解压安装包tar-xvfnginx-1.18.0.tar.g......
  • 【Python】Python安装指定版本库
    Python安装指定版本库安装指定的版本库在平时代码开发中是很有必要的操作,毕竟有些库之间相互依赖,如果版本不在依赖的范围之内,我们安装的库会报安装的依赖版本有问题。先看一下命令:pipinstall库名=版本号1示例:pipinstallnumpy==1.21.51如果你下载库的速度比较慢或者没办法下......
  • Mac安装Mysql5.7
    官网https://downloads.mysql.com/archives/community/下载Mysql5.7.31,再高5.7版本没有macOS选项安装安装完毕会弹出帐号密码这里要把密码记住,待会用mysqladmin重置密码时要用。启动mysql服务系统设置拉到最下面,启动mysql服务启动成功设置mysql服务端mysql命令别名aliasmysql=/usr......
  • MAC安装IDEA
    环境电脑:MacBookProM2ChipmacOS:Sonoma14.1.2IntelliJIDEAUltimate:2023.3.2-macOSAppleSilicon(dmg)下载官网:https://www.jetbrains.com/idea/download/other.html如果这篇文章对你有用,可以关注本人微信公众号获取更多ヽ(^ω^)ノ~......
  • Mac安装JDK1.8
    官网https://www.oracle.com/java/technologies/downloads/#java8-mac下载需要Oracle帐号安装点击安装一直下一步安装成功配置系统环境变量JDK主目录:/Library/Java/JavaVirtualMachinesJDK真实目录:/Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk/Contents/Homeopen~/.bash_......
  • Mac安装brew
    介绍Homebrew是一款包管理工具,目前支持macOS和Linux系统。主要有四个部分组成:brew、homebrew-core、homebrew-cask、homebrew-bottles。安装执行安装脚本执行/bin/zsh-c"$(curl-fsSLhttps://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"选阿里巴巴。验证安装成功执......
  • Linux CentOS7安装chrome和chromedriver,用于Selenium爬虫(java代码演示)
    ......
  • DC电源模块的安装和使用步骤是什么?
    BOSHIDADC电源模块的安装和使用步骤是什么?安装和使用DC电源模块的步骤如下:1.确定模块的电源需求:查阅模块的规格和说明书,确定所需的输入电压范围和输出电流能力。2.配置电源线:根据电源模块的输入要求,选择合适的电源线。确保电源线具备足够的额定电流和正确的接线方式。3.连接电......
  • ADB命令安装卸载手机APP
    前言手机内置的浏览器很多广告,推荐的新闻也很多负面的新闻,所以就想卸载内置的手机app,不过现在很多手机都是限制了内置的软件都不能卸载,以前随便获取一下root权限,也是可以卸载的,不过最近搞了一下,发现现在root权限这么难获取,所以就只能另外寻方法了,去网上搜了一下,发现可以使用adb命令......
  • Nessus安装 开源漏洞扫描程序
    Nessus安装下载链接:https://www.tenable.com/downloads/nessus?loginAttempted=trueubuntu linux版本(Nessus-10.6.4-ubuntu1404_amd64.deb)安装上传下载的文件到服务器后sudodpkg-iNessus-10.6.4-ubuntu1404_amd64.debsystemctlstartnessusd&&systemctlenableness......