Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。

安装Nginx依赖库

安装gcc g++的依赖库

apt-get install build-essential
apt-get install libtool

安装 pcre依赖库

sudo apt-get update
sudo apt-get install libpcre3 libpcre3-dev

安装 zlib依赖库

apt-get install zlib1g-dev

安装 ssl依赖库

apt-get install openssl

安装Nginx

下载最新版本

wget http://nginx.org/download/nginx-1.11.3.tar.gz

解压,编译

tar -zxvf nginx-1.11.3.tar.gz
cd nginx-1.11.3
./configure --prefix=/usr/local/nginx
make
sudo make install

启动nginx

sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ps -ef|grep nginx
root 7797 3211 0 09:43 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
nobody 7798 7797 0 09:43 ? 00:00:00 nginx: worker process
ysl 7804 4913 0 09:44 pts/1 00:00:00 grep --color=auto nginx

Nginx常用命令

启动 Nginx

/usr/local/nginx/sbin/nginx

停止 Nginx

./sbin/nginx -s stop
./sbin/nginx -s quit

Nginx重新加载配置

./sbin/nginx -s reload

指定配置文件

./sbin/nginx -c /usr/local/nginx/conf/nginx.conf

查看 Nginx 版本

./sbin/nginx -v
nginx version: nginx/1.11.3
sudo /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.11.3
built by gcc 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)
configure arguments: --prefix=/usr/local/nginx

检查配置文件是否正确

 sudo /usr/local/nginx/sbin/nginx -t

nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

显示帮助信息

sudo /usr/local/nginx/sbin/nginx -h

ginx version: nginx/1.11.3
Usage: nginx [-?hvVtTq] [-s signal] [-c filename] [-p prefix] [-g directives] Options:
-?,-h : this help
-v : show version and exit
-V : show version and configure options then exit
-t : test configuration and exit
-T : test configuration, dump it and exit
-q : suppress non-error messages during configuration testing
-s signal : send signal to a master process: stop, quit, reopen, reload
-p prefix : set prefix path (default: /usr/local/nginx/)
-c filename : set configuration file (default: conf/nginx.conf)
-g directives : set global directives out of configuration file

Ubuntu 16.04LTS安装Nginx的更多相关文章

  1. Ubuntu 16.04LTS 安装 MATLAB 2014B

    环境:Ubuntu 16.04LTS 软件:MATLAB 2014B MATLAB 2014B 下载地址(带Crack): 链接: https://pan.baidu.com/s/1nvGtmEd 密 ...

  2. Ubuntu 16.04LTS安装flashplayer

    转载自http://www.linuxdiyf.com/linux/20084.html 在安装Ubuntu 16.04LTS后,播放有视频的网页时,总提示你要安装缺失的插件,在 ubuntu 系统下 ...

  3. Ubuntu 16.04LTS 安装和配置Bochs

    环境:VMWare14+Ubuntu16.04 安装Bochs2.6.9 1.去官网下载 下载 bochs-2.6.9.tar.gz 2.安装一系列的包 因为Bochs 需要在 X11 环境下运行,因 ...

  4. Ubuntu 16.04安装Nginx

    在Ubuntu下安装Nginx有以下方法,但是如果想要安装最新版本的就必须下载源码包编译安装. 一.基于APT源安装 sudo apt-get install nginx 安装好的文件位置: /usr ...

  5. 【Ubuntu 16】安装nginx

    近年来,nginx服务器程序由于负载均衡.反向代理.适于高并发的特性,获得越来越多互联网企业的青睐.在此为大家奉上nginx的安装过程,以供参考. 一.安装nginx 1.安装gcc\g++库 sud ...

  6. Ubuntu 16.04LTS 安装 Node.js stable

    更新ubuntu软件源 sudo apt-get update sudo apt-get install -y python-software-properties software-properti ...

  7. ubuntu 16.10安装nginx

    1 : cd /usr/local 2 : sudo wget http://nginx.org/download/nginx-1.2.8.tar.gz 3 : sudo tar -zxvf ngin ...

  8. Ubuntu 16.04安装Matlab 2016b教程

    由于代码需要依赖Linux环境,只好尝试着装MATLAB,然而各种问题接踵而至,开始了由MATLAB引发的三天Linux探寻之旅-- 下载Matlab 2016b for Linux https:// ...

  9. Ubuntu 16.04 安装 Kodi v17 “Krypton” Alpha 2

    Ubuntu 16.04 安装 Kodi v17 “Krypton” Alpha 2:sudo add-apt-repository ppa:team-xbmc/xbmc-nightlysudo ap ...

随机推荐

  1. UI设计不就是画线框,凭什么年薪30W?

    作为一枚界面设计师 我真的很想为UI设计抱不平啊!! UI设计真是一个备受不解的职业 常会被误解,然后出现以下场景 程序欧巴: 界面画好没?按钮圆的方的不都能用吗?纠结那多干嘛? 产品经理: 这次我们 ...

  2. 优秀UX设计师的八条黄金法则

    与用户保持亲密   成为成功的UX设计师最重要的先决条件之一就是与用户保持紧密的联系,以发现和了解他们的需求和爱好.理想情况下你应该让自己完全地成为产品用户,因为只有这样你才能理解背后的动机.“这样的 ...

  3. Android 控制ScrollView滚动到底部或顶部

    在开发中,我们经常需要更新列表,并将列表拉倒最底部,比如发表微博,聊天界面等等, 这里有两种办法,第一种,使用scrollTo(): public static void scrollToBottom ...

  4. python之数据类型3和文件操作

    一 字典属性方法补充 key是不变的类型,字典能快速查找,基于哈希索引 不可变类型 int  bool  str  tuple  可变类型:list  dict  set 1 clear  :清空 # ...

  5. GitBash入门

    转载自:http://www.cnblogs.com/randomsteps/p/5415116.html 作为一个初学者,我是跟着廖学峰老师的官方博客学习,这里只是做个笔记,哈哈,关于git的历史. ...

  6. What Is Your Grade?

    Problem Description “Point, point, life of student!”This is a ballad(歌谣)well known in colleges, and ...

  7. PriorityQueue源码分析

          PriorityQueue其实是一个优先队列,和先进先出(FIFO)的队列的区别在于,优先队列每次出队的元素都是优先级最高的元素.那么怎么确定哪一个元素的优先级最高呢,jdk中使用堆这么一 ...

  8. Unity3D中随机函数的应用

    电子游戏中玩家与系统进行互动的乐趣绝大多数取决于事件发生的不可预知性和随机性.在unity3D的API中提供了Random类来解决随机问题. 最简单的应用就是在数组中随机选择一个元素,使用Random ...

  9. ABP框架中微服务跨域调用其它服务接口

    AjaxResponse为ABP自动包装的JSON格式 /// <summary> /// 通过地址和参数取得返回OutPut数据 /// </summary> /// < ...

  10. Angular6 学习笔记——内容投影, ViewChild和ContentChild

    angular6.x系列的学习笔记记录,仍在不断完善中,学习地址: https://www.angular.cn/guide/template-syntax http://www.ngfans.net ...