• linux服务基础之编译安装nginx


    nginx源码下载地址: 

    http://nginx.org/download/nginx-1.16.0.tar.gz  //根据需要下载其他版本

    1. 下载nginx

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

    2. 安装nginx

    解决依赖关系:

    # yum install pcre-devel

    添加运行nginx的用户和组:

    # groupadd -r nginx
    # useradd -r -g nginx nginx

    编译安装nginx:

    # tar xf nginx-1.16.0.tar.gz 
    # cd nginx-1.16.0
    # ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf --user=nginx --group=nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_flv_module --with-http_mp4_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
    # make && make install

    创建nginx编译安装时需要的目录:

    # mkdir -pv /var/tmp/nginx/{client,proxy,fastcgi,uwsgi}

    测试:

    # /usr/local/nginx/sbin/nginx  //运行nginx
    # ss -tnlp  //查看80端口是否被监听
    # ps aux | grep nginx
    root      37932  0.0  0.1  46896  1108 ?        Ss   18:49   0:00 nginx: master process /usr/local/nginx/sbin/nginx
    nginx     37933  0.0  0.1  47336  1704 ?        S    18:49   0:00 nginx: worker process 
    # elinks http://192.168.1.103  //可以看到nginx的欢迎页面

     

  • 相关阅读:
    LIB和 DLL区别
    C++ STL总结
    浅谈static和extern关系
    死锁及处理
    函数模板与模板函数
    Linux无法启动httpd_正在启动httpd
    httpd不允许远程连接问题
    虚拟机UUIDexist_更改UUID
    MySQL远程连接丢失问题
    Apache服务端允许跨域
  • 原文地址:https://www.cnblogs.com/ckh2014/p/10848623.html
Copyright © 2020-2023  润新知