nginx源码下载地址:

http://nginx.org/download/nginx-1.16.0.tar.gz  //根据需要下载其他版本

1. 下载nginx

# wget http://nginx.org/download/nginx-1.16.0.tar.gz

2. 安装nginx

解决依赖关系:

# yum install pcre-devel

添加运行nginx的用户和组:

# groupadd -r nginx
# useradd -r -g nginx nginx

编译安装nginx:

# tar xf nginx-1.16.0.tar.gz
# cd nginx-1.16.0
# ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
# make && make install

创建nginx编译安装时需要的目录:

# mkdir -pv /var/tmp/nginx/{client,proxy,fastcgi,uwsgi}

测试:

# /usr/local/nginx/sbin/nginx  //运行nginx
# ss -tnlp  //查看80端口是否被监听
# ps aux | grep nginx
root 37932 0.0 0.1 46896 1108 ? Ss 18:49 0:00 nginx: master process /usr/local/nginx/sbin/nginx
nginx 37933 0.0 0.1 47336 1704 ? S 18:49 0:00 nginx: worker process
# elinks http://192.168.1.103  //可以看到nginx的欢迎页面



最新文章

  1. PHP多维数组根据其中一个字段的值排序
  2. 搭建高可用mongodb集群(四)—— 分片
  3. Spring的循环依赖问题
  4. wamp集成环境开启虚拟主机多站点功能
  5. PHP命名空间概念解析
  6. JDBC-简单的学生管理系统-增删改查
  7. poj 3082多边形相交 'Roid Rage
  8. LeetCode: Best Time to Buy and Sell Stock II [122]
  9. IOS各种手势操作实例
  10. Spring Dubbo 开发笔记
  11. [Bayes] Variational Inference for Bayesian GMMs
  12. Javascript高级编程学习笔记(95)—— WebGL(1) 类型化数组
  13. codeforces-2
  14. RSA填充模式
  15. ibatis中的resultMap
  16. windows下java环境变量的配置 javac不是内部或外部命令的问题
  17. jqeury-地区三级联动
  18. C语言--第0次作业评分和总结(5班)
  19. 在Struts2框架中使用Servlet的API
  20. windbg 边学边记attach 进程和open dump的两个方式查看线程的占用cpu资源

热门文章

  1. 原生servlet项目启动自动加载一个方法
  2. 快速幂——while理解&&[P1965] 转圈游戏
  3. php 上传文件 示例
  4. 连接数据库的方法---ODBC
  5. window下建立vue.js项目
  6. 【问题】多重继承时,super函数只初始化继承的第一个类,不初始化第二个类。
  7. 写ppt的助手
  8. div中元素水平居中的方法
  9. linux--解决celery消息中间件带来的一系列问题
  10. C#的多线程简洁笔记