DDR爱好者之家 Design By 杰米
从Nginx切换到Tengine主要是因为 concat 模块(合并js、css),以及动态加载模块功能(DSO)。
如果已经用apt-get方式安装了Nginx,可以尝试以下步骤以切换到Tengine(不需要卸载Nginx):
1. 到官方下载你喜欢的Tengine版本,这里以最新版(1.4.0)为例,
复制代码 代码如下:
wget http://tengine.taobao.org/download/tengine-1.4.0.tar.gz
2. 解压缩:
复制代码 代码如下:
tar -xvzf tengine-1.4.0.tar.gz
3. 进入解压出来的文件夹:
复制代码 代码如下:
cd tengine-1.4.0/
4. 查看当前Nginx的编译参数:
复制代码 代码如下:
nginx -V
得到结果如下:
复制代码 代码如下:
nginx: nginx version: nginx/1.0.5
nginx: TLS SNI support enabled
nginx: configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.0.5/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.0.5/debian/modules/nginx-upstream-fair
5. 根据上面第三行的配置编译Tengine,具体做法:从--prefix=/etc/nginx开始复制第三行的代码,然后在--with-debug后面加上--with-http_concat_module(意前后需要有空格),并删掉从--add-module开始的代码(否则会编译不过),完整的编译脚本如下:
复制代码 代码如下:
./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_concat_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module
如果编译中出现类似下面的错误,说明编译依赖模块不存在,你可以选择安装或者如果你不需要这个模块的话,从上面的编译脚本中删除后再一次执行编译脚本,直到编译完成:
复制代码 代码如下:./configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.
这里提示XSLT模块不存在,在上面的编译脚本中搜索xslt,找到了--with-http_xslt_module,删除就可以了,同样注意前后的空格。
成功后提示如下(其中的路径是跟编译脚本有关的,所以可能会略有不同):
复制代码 代码如下:
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/etc/nginx"
nginx binary file: "/etc/nginx/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/lib/nginx/body"
nginx dso module path: "/etc/nginx/modules"
nginx http proxy temporary files: "/var/lib/nginx/proxy"
nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"
nginx http uwsgi temporary files: "/var/lib/nginx/uwsgi"
nginx http scgi temporary files: "/var/lib/nginx/scgi"
6. 继续编译(make就可以了,不需要make install):
复制代码 代码如下:
make
7. 到objs目录下编译好的nginx文件:
复制代码 代码如下:cd objs/
8. 停止nginx:
复制代码 代码如下: service nginx stop
9. 复制objs目录下的nginx文件到/usr/sbin/nginx目录,覆盖前记得备份原来文件:
复制代码 代码如下:cp /usr/sbin/nginx /usr/sbin/nginx.bak
cp nginx /usr/sbin/
9. 测试nginx是否正常(/user/sbin目录):
复制代码 代码如下:nginx -t
如果出现syntax is ok,test is successful表示成功:
复制代码 代码如下:the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful
10. 重新启动nginx
复制代码 代码如下:
service nginx start
访问服务器上一个不存在的页面,查看服务器是否是Tengine
复制代码 代码如下:
403 Forbidden
You don't have permission to access the URL on this server. Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!
URL: http://10.20.131.181/doc
Server: ubuntu-bak
Date: 2012/10/06 17:54:53
Powered by Tengine/1.4.0
注意看最后一行:Powered by Tengine/1.4.0 表示我们已经成功从Nginx切换到了Tengine
如果已经用apt-get方式安装了Nginx,可以尝试以下步骤以切换到Tengine(不需要卸载Nginx):
1. 到官方下载你喜欢的Tengine版本,这里以最新版(1.4.0)为例,
复制代码 代码如下:
wget http://tengine.taobao.org/download/tengine-1.4.0.tar.gz
2. 解压缩:
复制代码 代码如下:
tar -xvzf tengine-1.4.0.tar.gz
3. 进入解压出来的文件夹:
复制代码 代码如下:
cd tengine-1.4.0/
4. 查看当前Nginx的编译参数:
复制代码 代码如下:
nginx -V
得到结果如下:
复制代码 代码如下:
nginx: nginx version: nginx/1.0.5
nginx: TLS SNI support enabled
nginx: configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.0.5/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.0.5/debian/modules/nginx-upstream-fair
5. 根据上面第三行的配置编译Tengine,具体做法:从--prefix=/etc/nginx开始复制第三行的代码,然后在--with-debug后面加上--with-http_concat_module(意前后需要有空格),并删掉从--add-module开始的代码(否则会编译不过),完整的编译脚本如下:
复制代码 代码如下:
./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_concat_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module
如果编译中出现类似下面的错误,说明编译依赖模块不存在,你可以选择安装或者如果你不需要这个模块的话,从上面的编译脚本中删除后再一次执行编译脚本,直到编译完成:
复制代码 代码如下:./configure: error: the HTTP XSLT module requires the libxml2/libxslt
libraries. You can either do not enable the module or install the libraries.
这里提示XSLT模块不存在,在上面的编译脚本中搜索xslt,找到了--with-http_xslt_module,删除就可以了,同样注意前后的空格。
成功后提示如下(其中的路径是跟编译脚本有关的,所以可能会略有不同):
复制代码 代码如下:
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/etc/nginx"
nginx binary file: "/etc/nginx/sbin/nginx"
nginx configuration prefix: "/etc/nginx"
nginx configuration file: "/etc/nginx/nginx.conf"
nginx pid file: "/var/run/nginx.pid"
nginx error log file: "/var/log/nginx/error.log"
nginx http access log file: "/var/log/nginx/access.log"
nginx http client request body temporary files: "/var/lib/nginx/body"
nginx dso module path: "/etc/nginx/modules"
nginx http proxy temporary files: "/var/lib/nginx/proxy"
nginx http fastcgi temporary files: "/var/lib/nginx/fastcgi"
nginx http uwsgi temporary files: "/var/lib/nginx/uwsgi"
nginx http scgi temporary files: "/var/lib/nginx/scgi"
6. 继续编译(make就可以了,不需要make install):
复制代码 代码如下:
make
7. 到objs目录下编译好的nginx文件:
复制代码 代码如下:cd objs/
8. 停止nginx:
复制代码 代码如下: service nginx stop
9. 复制objs目录下的nginx文件到/usr/sbin/nginx目录,覆盖前记得备份原来文件:
复制代码 代码如下:cp /usr/sbin/nginx /usr/sbin/nginx.bak
cp nginx /usr/sbin/
9. 测试nginx是否正常(/user/sbin目录):
复制代码 代码如下:nginx -t
如果出现syntax is ok,test is successful表示成功:
复制代码 代码如下:the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful
10. 重新启动nginx
复制代码 代码如下:
service nginx start
访问服务器上一个不存在的页面,查看服务器是否是Tengine
复制代码 代码如下:
403 Forbidden
You don't have permission to access the URL on this server. Sorry for the inconvenience.
Please report this message and include the following information to us.
Thank you very much!
URL: http://10.20.131.181/doc
Server: ubuntu-bak
Date: 2012/10/06 17:54:53
Powered by Tengine/1.4.0
注意看最后一行:Powered by Tengine/1.4.0 表示我们已经成功从Nginx切换到了Tengine
DDR爱好者之家 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
DDR爱好者之家 Design By 杰米
暂无评论...
更新日志
2024年05月20日
2024年05月20日
- dnf角色名字
- 舅舅党爆料《星空》或将登陆P55平台!今年圣诞节上线
- 《方舟》开发商确定裁员6人!新作承诺不会受到影响
- 中式恐怖续作《纸嫁衣7》首曝PV公布!现已开启预约
- 周建军-老三骑驴.2017【FLAC】
- 谭维维.2007-耳界【天娱传媒】【WAV+CUE】
- 逃跑计划.2021-回到海洋【东亚星光】【FLAC分轨】
- 《对马岛》击败《战神》《蜘蛛侠》:同时在线最高单机
- 人民日报评《歌手》全开麦直播:抛去滤镜难能可贵
- 《DNF手游》可以下载了:现已开放角色创建
- 群星《醉爱对唱》[WAV+CUE][523M]
- 孟庭苇《留住这一刻》4CD[WAV+CUE][2.5G]
- 张杰《第1张》首版 [WAV+CUE][412M]
- 《永劫无间》反击《王者荣耀》:武道无穷,但请尊重“武道”
- 《星之破晓》回应《永劫无间》:蹭蹭精,莫挨,不欢迎!