• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

翟喆修

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

centos7安装nginx详细步骤

一、下载nginx安装包和所需依赖

groupadd -g 1002 nginx                                       #创建nginx用户
useradd -g 1002 -u 1002 nginx

cd /usr/local                                                #进入安装目录

wget https://nginx.org/download/nginx-1.16.1.tar.gz          #下载nginx1.16安装包

tar xf nginx-1.16.1.tar.gz                                   #解压

cd nginx-1.16.1/                                             #进入nginx目录

yum install -y vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel nettools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-Embed  
#安装依赖包

二、配置编译安装

./configure \               
    --user=nginx \
    --group=nginx \
    --with-threads \
    --with-file-aio \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_realip_module \
    --with-http_addition_module \
    --with-http_xslt_module=dynamic \
    --with-http_image_filter_module=dynamic \
    --with-http_geoip_module=dynamic \
    --with-http_sub_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_mp4_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_auth_request_module \
    --with-http_random_index_module \
    --with-http_secure_link_module \
    --with-http_degradation_module \
    --with-http_slice_module \
    --with-http_stub_status_module \
    --with-stream=dynamic \
    --with-stream_ssl_module \
    --with-stream_realip_module \
    --with-stream_geoip_module=dynamic \
    --with-stream_ssl_preread_module \
    --with-compat  \
    --with-pcre-jit					#配置编译模块

make && make install         #编译安装

vim /etc/profile             #将下方内容写入环境变量
export /usr/local/nginx/sbin:$PATH

source /etc/profile	#刷新环境变量使之生效

三、启动

nginx                #启动nginx
nginx -s reload      #重启nginx
nginx -s stop        #停止nginx

posted on 2022-03-11 08:04  栗子买一斤送半斤  阅读(680)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3