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. 对FPKM/RPKM以及TPM的理解

    对FPKM/RPKM以及TPM的理解 2018年07月03日 16:05:53 sixu_9days 阅读数:559 标签: FPKM/RPKMTPMRNA-Seq 更多 个人分类: RNA-Seq ...

  2. common常用到的类

    org.apache.commons.codec.digest.DigestUtils.md5Hex(String)    md5

  3. 2018.10.01 NOIP模拟 购买书籍(贪心+STL)

    传送门 一道有意思的贪心. 感觉使用了网络流推流反悔的思想. 考虑维护三个setsetset维护a[i]−b[i],b[i]a[i]-b[i],b[i]a[i]−b[i],b[i]和a[i]a[i]a ...

  4. Django模型层(2)

    https://www.cnblogs.com/yuanchenqi/articles/8963244.html from django.db import models class Author(m ...

  5. gridcontrol 图片列异步加载

    在gridview中指定一列,将ColumnEdit设置成pictureEdit 在使用showDialog这里窗体后,需要frm.Dispose()将资源释放 1.将该列的UnboundType属性 ...

  6. 优秀前端工程师必备:" checkbox & radio--单钩 & 多钩 "大比较:你是♂||♀ , 还是 ♂&♀

    1 单选: type="radio"  需求: 男女input只能选择一个 <input type="radio" name="sex" ...

  7. UVa 11732 "strcmp()" Anyone? (左儿子右兄弟前缀树Trie)

    题意:给定strcmp函数,输入n个字符串,让你用给定的strcmp函数判断字符比较了多少次. 析:题意不理解的可以阅读原题https://uva.onlinejudge.org/index.php? ...

  8. Java synchronized关键字的理解

    转载自:http://blog.csdn.net/xiao__gui/article/details/8188833 在Java中,synchronized关键字是用来控制线程同步的,就是在多线程的环 ...

  9. 201709012工作日记--一台电脑创建两个Github账户上传代码

    1. 在一台主机上面使用多个GitHub账号 有时候,我们需要将个人账号和公司账号区分,这时候我们就会需要在一台电脑上使用2个不同的git账号. 2. 上传文件 http://blog.csdn.ne ...

  10. 数据分析工具R和RStudio入门介绍

    https://www.cnblogs.com/yjd_hycf_space/p/6672995.html Python&R语言-python和r相遇:https://www.cnblogs. ...