如何编译安装请参考我的另一篇博客: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.key apt-key add nginx_signing.key
deb http://nginx.org/packages/mainline/ubuntu/ raring nginx deb-src http://nginx.org/packages/mainline/ubuntu/ raring nginx
注意,raring需要换成你对应Ubuntu的code name, 比如13.10的saucy
apt-get update apt-get install nginx
nginx -v nginx 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 configtest nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: 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
/var/run/nginx.pid
7. 编译选项,用-V可以查看编译nginx程序编译时的选项:
nginx -V nginx version: nginx/1.5.0 built by gcc 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1) 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-mail --with-mail_ssl_module --with-file-aio --with-http_spdy_module --with-ipv6
--with-debug
参考官方文档:http://nginx.org/en/docs/debugging_log.html