您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 驻马店分类信息网,免费分类信息发布

ubuntu 下 升级 nginx

2024/6/1 3:30:49发布14次查看
我的是一开始用 apt-get install nginx 安装的,所以下面是 在已经安装的情况下升级
下载 stable版本的nginx :
    http://nginx.org/en/download.html 这里 我下载的 1.6.2 stable 版本
进入到要保存文件的目录 我的是 cd /home
   wget  http://nginx.org/download/nginx-1.6.2.tar.gz
然后 解压 文件
    tar -zxvf nginx-1.6.2.tar.gz
使用 nginx -v 查看自己的参数(v是大写):
比如我的是:
进去到你下载并解压好的文件夹下,比如我解压的文件在 /home/nginx-1.6.2 :
cd /home/nginx-1.6.2
执行 ./configure 后面跟上你的 --prefix 比如 我的:
./configure --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_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_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module
回车:
可能会出现问题 因为你一开始的 nginx不是编译的 ,可能出现以下一些问题(我出现的问题,如果和我的不一样 去google):
安装libxslt
./configure: error: the http xslt module requires the libxml2/libxslt libraries.
apt-get install libxslt1-dev(注意这里的 可能和你的不一样 当你打 libxslt 时 按tab 看会出现什么 东西 因为软件可能和你的不一样)
缺少gd library
./configure: error: the http image filter module requires the gd library.
apt-get install libgd2-xpm libgd2-xpm-dev 和上面的 一样 按 tab 看给你什么东西
以下的 可能你会遇到:
rewrite需要pcre支持
./configure: error: the http rewrite module requires the pcre library.
apt-get install libpcre3 libpcre3-dev 和上面的 一样 按 tab 看给你什么东西
http cache需要openssl
./configure: error: the http cache module requires md5 functions from openssl library.
apt-get install libssl-dev openssl 和上面的 一样 按 tab 看给你什么东西
安装geoip library
./configure: error: the geoip module requires the geoip library.
apt-get install libgeoip-dev 和上面的 一样 按 tab 看给你什么东西
在 执行 ./configure --prefix ......  //这里是你的 参数不要复制过去
好了后会看到 这个 :
然后执行 make,等待结束
用 which nginx 查看你的 nginx 启动程序在哪 我的在 /usr/sbin/nginx
备份旧版本的nginx可执行文件
mv  /usr/sbin/nginx    /usr/sbin/nginx.old
复制新版本的nginx这行文件
因为 前面你到了nginx-1.6.2文件夹下 用 ls  查看 会发现有个 objs 目录
cp  objs/nginx   /usr/sbin/
查看  是否正确   :
nginx -t
如果出现这个 说明真确
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
执行 make upgrade (说明 可能你在别的地方看到 make install   如果是 升级 应该是 upgrade)
如果尼出现了错误那么修改一下makefile(ls 就能看到这个文件)里面的upgrade标签下的路径,修改为正确的nginx可执行文件的路径,ubuntu下一般是/usr/sbin/nginx (就是用which nginx 看到的 路径 )这时 你会 看到 有clean  install 和 upgrade 等 我们 make upgrade  就是执行这个 upgrade  如果你在 其他 地方看到 最后运行
kill -usr2 `cat /usr/local/nginx/logs/nginx.pid` 等 其他的 命令 这里 你运行  make upgrade  就行 了因为里面已经包含了你要的命令  这也是最后一步
至此  已经升级完成  nginx -v (小v)查看版本已经是 1.6.2 版本 如果 不放心 可以 service nginx  restart 重启 一边
以上就介绍了ubuntu 下 升级 nginx,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。
驻马店分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录