CentOS 7 x64 下 编译安装 Tengine 2.0.3 详解(2)

*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

:wq #保存退出

#重启防火墙使配置生效

[root@centos ~]# systemctl restart iptables.service

#设置防火墙开机启动

[root@centos ~]# systemctl enable iptables.service

4.9 作为服务,开机后启动

[root@centos ~]# vim /usr/lib/systemd/system/tengine.service

增加以下内容

[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

:wq 保存退出

[root@centos ~]# systemctl stop tengine

[root@centos ~]# systemctl start tengine

[root@centos ~]# systemctl reload tengine

[root@centos ~]# systemctl enable tengine

[root@centos ~]# shutdown -r now

相关阅读

CentOS 6.4制作Tengine的rpm包

Tengine动态开启模块试用

CentOS 6.3用ICC编译PHP5.4.8+Percona5.5.27+Tengine1.4.1

基于淘宝Tengine和Scribe的WEB日志收集方案

基于Tengine部署LNMP环境

Tengine 的详细介绍请点这里
Tengine 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/3726ec8b54d97ea5af9acd4c8a8f6138.html