栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

linux 自定义目录安装nginx

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

linux 自定义目录安装nginx

1.环境准备:
yum -y install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
2.上传文件并解压 或者通过wget下载文件
例如:
wget -c https://nginx.org/download/nginx-1.18.0.tar.gz
tar -zxvf nginx-1.18.0.tar.gz
3.安装配置执行(自定义安装目录)
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_sub_module --with-http_gzip_static_module --with-pcre

#–prefix 指定安装路径
#–with-http_stub_status_module 允许查看nginx状态的模块
#–with-http_ssl_module 支持https的模块

  1. make && make install
  2. 开机脚本制作
  3. 5.1目录·/usr/lib/systemd/system
  4. vim nginx.service
#!/bin/sh
[Unit]

Description=nginx service

After=network.target

[Service]

Type=forking

PIDFile=/usr/local/software/nginx/logs/nginx.pid

ExecStart=/usr/local/software/nginx/sbin/nginx

ExecReload=/usr/local/software/nginx/sbin/nginx -s reload

ExecStop=/usr/local/software/nginx/sbin/nginx -s stop

PrivateTmp=true
[Install]
WantedBy=multi-user.target
  1. chmod 777 nginx.service
  2. systemctl daemon-reload
  3. systemctl enable nginx.service
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/333616.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号