日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
CentOS下yum安裝Nginx平滑切換安裝到Tengine

據(jù)說(shuō)淘寶的Tengine很牛X,所以我們今天也來(lái)玩玩,我們這里是某開(kāi)放云的vps,現(xiàn)在已經(jīng)安裝好了Nginx,現(xiàn)在我們要在centos 下平滑切換到安裝Tengine。

  • 下載Tengine,解壓進(jìn)入文件夾:

wget http://tengine.taobao.org/download/tengine-2.1.0.tar.gz

tar xvfz tengine-2.1.0.tar.gz

cd tengine-2.1.0

  • 查看一下當(dāng)前的nginx版本:

nginx -V

運(yùn)行結(jié)果如下:

nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
TLS SNI support enabled
configure arguments: –prefix=/etc/nginx –sbin-path=/usr/sbin/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-log-path=/var/log/nginx/access.log –pid-path=/var/run/nginx.pid –lock-path=/var/run/nginx.lock –http-client-body-temp-path=/var/cache/nginx/client_temp –http-proxy-temp-path=/var/cache/nginx/proxy_temp –http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp –http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp –http-scgi-temp-path=/var/cache/nginx/scgi_temp –user=nginx –group=nginx –with-http_ssl_module –with-http_realip_module –with-http_addition_module –with-http_sub_module –with-http_dav_module –with-http_flv_module –with-http_mp4_module –with-http_gunzip_module –with-http_gzip_static_module –with-http_random_index_module –with-http_secure_link_module –with-http_stub_status_module –with-http_auth_request_module –with-mail –with-mail_ssl_module –with-file-aio –with-ipv6 –with-http_spdy_module –with-cc-opt=’-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables’

然后我們復(fù)制一下下面的編譯參數(shù) configure arguments:開(kāi)始一直到最后。

  • 開(kāi)始編譯Tengine,運(yùn)行代碼:

./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables'

結(jié)果錯(cuò)誤,如下圖所示:

./configure: error: C compiler cc is not found

主要是我們系統(tǒng)里面沒(méi)有C語(yǔ)言,現(xiàn)在補(bǔ)上gcc編譯環(huán)境:

yum install gcc

重新運(yùn)行編譯命令,依然報(bào)錯(cuò):

./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using –without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using –with-pcre= option.

缺少pcre,安裝pcre:

yum install pcre-devel

再次編譯,結(jié)果如下圖,缺少openssl:

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using –with-openssl= option.

 

安裝openssl:

yum -y install openssl openssl-devel

再次編譯成功,返回:

Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
+ jemalloc library is disabled

nginx path prefix: “/etc/nginx”
nginx binary file: “/usr/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/cache/nginx/client_temp”
nginx dso module path: “/etc/nginx/modules/”
nginx http proxy temporary files: “/var/cache/nginx/proxy_temp”
nginx http fastcgi temporary files: “/var/cache/nginx/fastcgi_temp”
nginx http uwsgi temporary files: “/var/cache/nginx/uwsgi_temp”
nginx http scgi temporary files: “/var/cache/nginx/scgi_temp”

MAKE,命令行里直接打make就行了,如下圖:

make

make成功,則如下圖所示:

  • nginx停止運(yùn)行:

/etc/init.d/nginx stop

  • 遷移文件:

復(fù)制objs目錄下的nginx文件到/usr/sbin/nginx目錄,覆蓋前記得備份原來(lái)文件:

cp /usr/sbin/nginx /usr/sbin/nginx.bak
cp objs/nginx /usr/sbin/

  • 測(cè)試一下nginx:

 nginx -t

the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful

  • 啟動(dòng)nginx服務(wù):

service nginx start

Starting nginx:                                            [  OK  ]

測(cè)試Tengine 是否成功:

我們這里輸入一個(gè)不存在的頁(yè)面看看報(bào)錯(cuò)就知道了,如下圖所示:

Tegine 是兼容nginx配置文件的,所以我們?cè)扰渲煤玫臇|西就不用再麻煩去修改啦。

相關(guān)閱讀


網(wǎng)站標(biāo)題:CentOS下yum安裝Nginx平滑切換安裝到Tengine
當(dāng)前鏈接:http://www.dlmjj.cn/article/djsoepg.html