神剑山庄资源网 Design By www.hcban.com
Nginx ("engine x") 是一个高性能的 HTTP 和 反向代理 服务器,也是一个 IMAP/POP3/SMTP 代理服务器。 Nginx 是由 Igor Sysoev 为俄罗斯访问量第二的 Rambler.ru 站点开发的,第一个公开版本0.1.0发布于2004年10月4日。其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、示例配置文件和低系统资源的消耗而闻名。
安装Nginx依赖库
安装gcc g++的依赖库
ubuntu平台可以使用如下命令。
apt-get install build-essential apt-get install libtool
centeros平台可以使用如下命令。
centos平台编译环境使用如下指令
安装make:
yum -y install gcc automake autoconf libtool make
安装g++:
yum install gcc gcc-c++
安装 pcre依赖库(http://www.pcre.org/)
sudo apt-get update sudo apt-get install libpcre3 libpcre3-dev
安装 zlib依赖库(http://www.zlib.net)
apt-get install zlib1g-dev
安装 ssl依赖库
apt-get install openssl
安装Nginx(http://nginx.org)
#下载最新版本: 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 #编辑nginx: make 注意:这里可能会报错,提示“pcre.h No such file or directory”,具体详见:http://stackoverflow.com/questions/22555561/error-building-fatal-error-pcre-h-no-such-file-or-directory 需要安装 libpcre3-dev,命令为:sudo apt-get install libpcre3-dev #安装nginx: sudo make install #启动nginx: sudo /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 注意:-c 指定配置文件的路径,不加的话,nginx会自动加载默认路径的配置文件,可以通过 -h查看帮助命令。 #查看nginx进程: ps -ef|grep nginx
Nginx常用命令
启动 Nginx
/usr/local/nginx/sbin/nginx ./sbin/nginx
停止 Nginx
./sbin/nginx -s stop ./sbin/nginx -s quit
-s都是采用向 Nginx 发送信号的方式。
Nginx重新加载配置
./sbin/nginx -s reload
指定配置文件
./sbin/nginx -c /usr/local/nginx/conf/nginx.conf
-c表示configuration,指定配置文件
查看 Nginx 版本
有两种可以查看 Nginx 的版本信息的参数。第一种如下:
./sbin/nginx -v nginx: nginx version: nginx/1.0.0
另一种显示的是详细的版本信息:
poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -V nginx: nginx version: nginx/1.0.0 nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4) nginx: TLS SNI support enabled nginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/
检查配置文件是否正确
poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -t nginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied) nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok 2012/01/09 16:45:09 [emerg] 23898#0: open() "/usr/local/nginx/logs/nginx.pid" failed (13: Permission denied) nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
如果出现如上的提示信息,表示没有访问错误日志文件和进程,可以sudo(super user do)一下:
poerchant@ubuntu:/usr/local/nginx$ sudo ./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
如果显示如上,则表示配置文件正确。否则,会有相关提示。
显示帮助信息
poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -h
或者:
poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -?
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
神剑山庄资源网 Design By www.hcban.com
神剑山庄资源网
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
神剑山庄资源网 Design By www.hcban.com
暂无Ubuntu16.04.1 安装Nginx的方法的评论...
更新日志
2024年09月20日
2024年09月20日
- 《绝对主打 流行原创金曲 2CD》[WAV分轨][1.1GB]
- 《赛博朋克2077》更新上线:支持AMD FSR3
- 《塞尔达传说:智慧的再现》提前半个月偷跑,引发玩家担忧
- 战锤40K星际战士2全职业介绍|全职业技能效果一览
- 陈百强《2006世纪10星·永恒篇[环球]》[WAV整轨]
- 【新世纪钢琴】VA-GoldenOctober(Piano)(金秋十月钢琴篇)【FLAC】
- 青稞荞麦《破茧》新生代组合[WAV+CUE]
- 因系统升级后出现BUG 《FF16》PS5完全版宣布延期
- 《黑神话:悟空》周伯通!大佬用左右手分别挑战两只虎先锋
- 《黑神话:悟空》攻击动作致敬《大话西游》:这也太帅了!
- 《星舰铳犬太阳系物语》游戏背景介绍
- 《战锤40K星际战士2》终极版有后续DLC说明
- 《第9层》游戏特色玩法介绍
- 刀郎.2006-刀郎【九雨天下】【WAV+CUE】
- 59.9高校生.1994-素兰万岁【上华】【WAV+CUE】