Github: Tengine: 【Star:9.2K】
https://github.com/alibaba/tengine
Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。
Github: Nginx: 【Star:9.8K】
https://github.com/nginx/nginx
Nginx 是一个高性能的 Web 和反向代理服务器, 它具有有很多非常优越的特性:
作为 Web 服务器:相比 Apache,Nginx 使用更少的资源,支持更多的并发连接,体现更高的效率,这点使 Nginx 尤其受到虚拟主机提供商的欢迎。能够支持高达 50,000 个并发连接数的响应,感谢 Nginx 为我们选择了 epoll and kqueue 作为开发模型.
作为负载均衡服务器:Nginx 既可以在内部直接支持 Rails 和 PHP,也可以支持作为 HTTP代理服务器 对外进行服务。Nginx 用 C 编写, 不论是系统资源开销还是 CPU 使用效率都比 Perlbal 要好的多。
作为邮件代理服务器: Nginx 同时也是一个非常优秀的邮件代理服务器(最早开发这个产品的目的之一也是作为邮件代理服务器),Last.fm 描述了成功并且美妙的使用经验。
Nginx 安装非常的简单,配置文件 非常简洁(还能够支持perl语法),Bugs非常少的服务器: Nginx 启动特别容易,并且几乎可以做到7*24不间断运行,即使运行数个月也不需要重新启动。你还能够在 不间断服务的情况下进行软件版本的升级。
[root@ip104 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
下载安装包安装Tengine-2.3.0
下载pcre-8.39.tar.gz【依赖】
下载zlib-1.2.11.tar.gz【依赖】
下载openssl-1.0.1h.tar.gz【依赖】
下载jemalloc-3.6.0.tar.bz2 【依赖】
下载 tengine-2.3.0.tar.gz
yum install gcc-c++
yum -y install pcre pcre-devel
yum -y install zlib zlib-devel
yum -y install openssl openssl-devel
1.3.1 【yum install gcc-c++】 需要输入一次y 继续下载安装
[root@ip104 ~]# yum install gcc-c++
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
..............................等待,需要输入一次y 继续下载安装............................
Total download size: 31 M
Is this ok [y/d/N]: y
Downloading packages:
..............................等待............................
Complete!
1.3.2 【yum -y install pcre pcre-devel 】
[root@ip104 ~]# yum -y install pcre pcre-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
..............................等待............................
Complete!
1.3.3【yum -y install zlib zlib-devel】
[root@ip104 ~]# yum -y install zlib zlib-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package zlib-1.2.7-18.el7.x86_64 already installed and latest version
.............................等待............................
Complete!
1.3.4【yum -y install openssl openssl-devel】
[root@ip104 ~]# yum -y install openssl openssl-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
..............................等待............................
Complete!
cd /usr/local/src/
wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
ls
tar -zxvf tengine-2.3.2.tar.gz
cd /usr/local/src/tengine-2.3.2
./configure
make
sudo make install
[root@ip104 ~]# cd /usr/local/src/
[root@ip104 src]# wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
--2019-10-01 12:37:03-- http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
Resolving tengine.taobao.org (tengine.taobao.org)... 140.205.172.18
Connecting to tengine.taobao.org (tengine.taobao.org)|140.205.172.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2835884 (2.7M) [application/octet-stream]
Saving to: ‘tengine-2.3.2.tar.gz’
100%[==============================================>] 2,835,884 531KB/s in 5.3s
2019-10-01 12:37:08 (521 KB/s) - ‘tengine-2.3.2.tar.gz’ saved [2835884/2835884]
[root@ip104 src]# ls
tengine-2.3.2.tar.gz
--------下载安装包--------
[root@ip104 tengine-2.3.2]# cd /usr/local/src/
[root@ip104 src]# ls
rarlinux-x64-5.4.0.tar.gz tengine-2.3.2 tengine-2.3.2.tar.gz
[root@ip104 src]#
--------编译安装--------
[root@ip104 tengine-2.3.2]# cd /usr/local/src/tengine-2.3.2
[root@ip104 tengine-2.3.2]# ls
AUTHORS.te CHANGES.cn configure html man packages tests
auto CHANGES.te contrib LICENSE modules README.markdown THANKS.te
CHANGES conf docs Makefile objs src
[root@ip104 tengine-2.3.2]#
Tengine完全兼容Nginx,因此可以参照Nginx的方式来配置Tengine。我们在此只列出Tengine中值得注意的功能。关于详细的Tengine的相对于Nginx的差别,可以访问变更列表。
输入以下命令
vi /lib/systemd/system/nginx.service
输入以下编辑内容。按键:esc 输入 :wq 保存配置文件
#配置 Tengine config
[Unit]
Description=The nginx HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
------启动nginx服务
systemctl start nginx.service
------设置开机自启动
systemctl enable nginx.service
------停止开机自启动
------查看服务当前状态
systemctl status nginx.service
------重新启动服务
systemctl restart nginx.service
------查看所有已启动的服务
systemctl list-units --type=service
[root@ip104 src]# vi /lib/systemd/system/nginx.service
[root@ip104 src]# systemctl start nginx.service
[root@ip104 src]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2019-10-01 13:09:43 CST; 7s ago
Process: 8441 ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf (code=exited, status=0/SUCCESS)
Process: 8439 ExecStartPre=/usr/local/nginx/sbin/nginx -t (code=exited, status=0/SUCCESS)
Main PID: 8444 (nginx)
Tasks: 2
Memory: 1.5M
CGroup: /system.slice/nginx.service
├─8444 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/ngi...
└─8445 nginx: worker process
Oct 01 13:09:43 ip104 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Oct 01 13:09:43 ip104 nginx[8439]: nginx: the configuration file /usr/local/nginx/... ok
Oct 01 13:09:43 ip104 nginx[8439]: nginx: configuration file /usr/local/nginx/conf...ful
Oct 01 13:09:43 ip104 systemd[1]: Started The nginx HTTP and reverse proxy server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@ip104 src]#
Welcome to tengine!
If you see this page, the tengine web server is successfully
installed and working. Further configuration is required.
For online documentation and support please refer to tengine.taobao.org.
Thank you for using tengine.
PCRE 下载地址:
https://ftp.pcre.org/pub/pcre/
[root@ip104 src]# cd /usr/local/src/
[root@ip104 src]# wget http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz
[root@ip104 src]# tar zxvf pcre-8.35.tar.gz
[root@ip104 src]# cd pcre-8.35
[root@ip104 pcre-8.35]# ./configure
[root@ip104 pcre-8.35]# make && make install
[root@ip104 src]# cd /usr/local/src/
[root@ip104 src]# wget http://nginx.org/download/nginx-1.6.2.tar.gz
[root@ip104 src]# tar zxvf nginx-1.6.2.tar.gz
[root@ip104 src]# cd nginx-1.6.2
[root@ip104 nginx-1.6.2]# ./configure --prefix=/usr/local/webserver/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
[root@ip104 nginx-1.6.2]# make
[root@ip104 nginx-1.6.2]# make install
vi /usr/local/nginx/conf/nginx.conf
server {
listen 80;
server_name example.com *.example.com;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
--重新启动
systemctl restart nginx
--查看状态
systemctl status nginx
[root@ip104 ~]# cd /usr/local/nginx/sbin
[root@ip104 sbin]# ./nginx -V
Tengine version: Tengine/2.3.2
nginx version: nginx/1.17.3
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments:
[root@ip104 sbin]#
相关资源后续更新
touch .bash_profile。配置环境变量
java -verbose-查看jdk安装路径
java -version-查看jdk版本
vim-编辑
pwd-查看当前工作路径
su root -切换到root下
netstat -ntlp //查看当前所有tcp端口
ps -ef | grep //查看进程号
ps命令将某个进程显示出来
手机扫一扫
移动阅读更方便
你可能感兴趣的文章