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