• nginx源码安装


    nginx源码安装

    1、前提准备

    准备主机

    主机名称 IP 作用
    client 192.168.7.11 nginx主机

    下载nginx软件包:http://nginx.org/download/nginx-1.14.0.tar.gz

    关闭防火墙和selinux

    # systemctl stop firewalld
    # systemctl disable firewalld
    # setent
    

    下载插件并且创建nginx用户

    #  yum -y install pcre-devel openssl openssl-devel gd-devel
    #  yum -y groups mark install 'Development Tools' 
    #  useradd -r -M -s /sbin/nologin nginx
    //创建日志目录
    # mkdir -p /var/log/nginx
    # chown -R nginx.nginx /var/log/nginx
    

    2、安装

    下载并且解压nginx

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

    进入安装目录进行编译安装

    # pwd
    /root/nginx-1.14.0
    # ./configure --prefix=/usr/local/nginx 
    --user=nginx 
    --group=nginx  
    --with-debug  
    --with-http_ssl_module 
    --with-http_realip_module  
    --with-http_image_filter_module  
    --with-http_gunzip_module  
    --with-http_gzip_static_module  
    --with-http_stub_status_module  
    --http-log-path=/var/log/nginx/access.log  
    --error-log-path=/var/log/nginx/error.log
    
    #  make -j $(grep 'processor' /proc/cpuinfo | wc -l) && make install 
    

    查看并且启动

    # /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    # cd /usr/local/nginx/sbin/
    # ls
    nginx 
    

    3、nginx后续配置

    添加环境变量

    # echo "export PATH=/usr/local/nginx/sbin/:$PATH" > /etc/profile.d/nginx.sh
    #  /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    # nginx -s start
    # ss -antl
    State       Recv-Q Send-Q               Local Address:Port                              Peer Address:Port              
    LISTEN      0      128                              *:80                                           *:*                  
    LISTEN      0      128                              *:22                                           *:*                  
    LISTEN      0      100                      127.0.0.1:25                                           *:*                  
    LISTEN      0      128                             :::22                                          :::*                  
    LISTEN      0      100                            ::1:25                                          :::*       
    
    

  • 相关阅读:
    欢迎使用CSDN-markdown编辑器
    银行票据
    【思考】:怎样把论文按照一定格式生成模板?
    ARP地址解析协议
    ACL访问控制列表
    dns域名系统
    NAT网络地址转换
    MAC地址如何在windows与unix下查看?
    银行承兑汇票的推广与使用给中国企业带来的影响?
    win7 复制文件慢的解决方法
  • 原文地址:https://www.cnblogs.com/liuzhijun666/p/13124033.html
Copyright © 2020-2023  润新知