Ubuntu 13 04 安装最新版本的Nginx

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

               

如何编译安装请参考我的另一篇博客:http://blog.csdn.net/sheismylife/article/details/6744394

如何直接使用Ubuntu默认的Nginx版本,请参考:http://blog.csdn.net/sheismylife/article/details/8140591

但是默认在Ubuntu13.04下安装得到的Nginx版本居然是1.2.x,太低了。

下面描述如何获取最新的安装包:

1.添加key

wget http://nginx.org/keys/nginx_signing.keyapt-key add nginx_signing.key

2.创建/etc/apt/sources.list.d/nginx.list文件,内容如下:

deb http://nginx.org/packages/mainline/ubuntu/ raring nginxdeb-src http://nginx.org/packages/mainline/ubuntu/ raring nginx

注意,raring需要换成你对应Ubuntu的code name, 比如13.10的saucy


3.更新及安装:

apt-get updateapt-get install nginx

4.检查一下版本

nginx -vnginx version: nginx/1.5.0

5. 命令行

前面的安装在/etc/init.d/目录下创建了nginx脚本,该脚本支持几个命令参数:

echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-reload|upgrade|configtest}" >&2

非常好用。比如测试配置的参数:

service nginx configtestnginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is successful


6. 进程id

官方文档说:http://nginx.org/en/docs/control.html

进程id文件默认在

/usr/local/nginx/logs/nginx.pid

但实际上在nginx脚本文件中将其放在了

/var/run/nginx.pid

7. 编译选项,用-V可以查看编译nginx程序编译时的选项:

 nginx -Vnginx version: nginx/1.5.0built by gcc 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) TLS SNI support enabledconfigure 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-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-ipv6

基本够用,如果要打开debug日志的话,此版本没有。需要自己编译Nginx,并使用下面的参数:
--with-debug

参考官方文档:http://nginx.org/en/docs/debugging_log.html


           

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

这里写图片描述

猜你喜欢

转载自blog.csdn.net/fduffyyg/article/details/84192601