源码安装nginx

1. For ubuntu:18.04

apt -y install build-essential libtool libpcre3 libpcre3-dev zlib1g-dev openssl net-tools curl wget
wget -P /tmp http://nginx.org/download/nginx-1.18.0.tar.gz
tar -xf /tmp/nginx-1.18.0.tar.gz -C /usr/local/src
cd /usr/local/src/nginx-1.18.0 && ./configure --prefix=/usr/local/nginx
make && make insatll

增强性能或功能需要优化或使用其他方案

2. For Centos7

yum -y install gcc pcre-devel openssl-devel zlib-devel
useradd -s /sbin/nologin nginx -M
wget -P /tmp http://nginx.org/download/nginx-1.18.0.tar.gz
tar -xf /tmp/nginx-1.18.0.tar.gz -C /usr/local/src
cd /usr/local/src/nginx-1.18.0
./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_v2_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-pcre \
--with-stream \
--with-stream_ssl_module \
--with-stream_realip_module
make && make install
chown -R nginx.nginx /usr/local/nginx
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/ # cat /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target [Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID [Install]
WantedBy=multi-user.target # systemctl daemon-reload
# systemctl enable --now nginx

PS:

Ubuntu安装Nginx

最新文章

  1. nandflash驱动程序编写
  2. 安装在CloudStack时CentOS6.4中安装MySQL通过mysql_secure_installation方式修改密码
  3. lsll 加载段限长指令
  4. 彩色照片转换为黑白照片(Color image converted to black and white picture)
  5. HDU 1498 50 years, 50 colors (行列匹配+最小顶点覆盖)
  6. web开发工具类
  7. Mac下载并编译Google安卓AOSP项目代码
  8. http to https automatic--weblogic/jboss/tomcat--reference
  9. C#显示声名接口就是为了解决方法重名的问题
  10. git merge,rebase和*(no branch)
  11. Spring AOP With AspectJ
  12. CentOS7 docker试水
  13. Jvm类的加载机制
  14. mysql 报错You can't specify target table 'wms_cabinet_form' for update in FROM clause
  15. 小程序util工具
  16. docker 方式运行drill
  17. 约瑟夫(Josephus)问题~转
  18. Gradle Goodness: Automatic Clean Tasks
  19. 题解 P4092 【[HEOI2016/TJOI2016]树】
  20. js中将Object转换为String函数代码

热门文章

  1. (十五)VMware Harbor 标签管理
  2. Jenkins 自定义构建结果
  3. Dubbo学习笔记(一) 基础知识HelloWorld
  4. fastjson反序列化漏洞实际案例利用
  5. Kafka原理分析之基础篇
  6. Tomcat部署环境
  7. 路由器逆向分析------Running Debian MIPS Linux in QEMU
  8. hdu4768 非常规的二分
  9. hdu4454 三分 求点到圆,然后在到矩形的最短路
  10. Win64 驱动内核编程-21.DKOM隐藏和保护进程