zoukankan      html  css  js  c++  java
  • nginx的安装与配置

    nginx的安装

    //创建系统用户nginx
    [root@nginx ~]# useradd -r -M -s /sbin/nologin nginx
    
    //安装依赖环境
    [root@nginx ~]# yum -y install pcre-devel openssl openssl-devel gd-devel gcc gcc-c++
    [root@nginx ~]# yum -y groups mark install 'Development Tools'
    Loaded plugins: product-id, search-disabled-repos, subscription-manager
    This system is not registered with an entitlement server. You can use subscription-manager to register.
    There is no installed groups file.
    Maybe run: yum groups mark convert (see man yum)
    Marked install: Development Tools
    
    //创建日志存放目录
    [root@nginx ~]# mkdir -p /var/log/nginx
    [root@nginx ~]# chown -R nginx.nginx /var/log/nginx
    
    //下载nginx
    [root@nginx ~]#  cd /usr/src/
    [root@nginx src]# wget http://nginx.org/download/nginx-1.12.0.tar.gz
    --2021-05-24 23:01:08--  http://nginx.org/download/nginx-1.12.0.tar.gz
    Resolving nginx.org (nginx.org)... 52.58.199.22, 3.125.197.172, 2a05:d014:edb:5704::6, ...
    Connecting to nginx.org (nginx.org)|52.58.199.22|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 980831 (958K) [application/octet-stream]
    Saving to: ‘nginx-1.12.0.tar.gz’
    
    nginx-1.12.0.tar.gz          100%[============================================>] 957.84K  11.9KB/s    in 76s     
    
    2021-05-24 23:02:25 (12.5 KB/s) - ‘nginx-1.12.0.tar.gz’ saved [980831/980831]
    
    //编译安装
    [root@nginx src]# ls
    debug  kernels  nginx-1.12.0.tar.gz
    [root@nginx src]# tar xf nginx-1.12.0.tar.gz
    [root@nginx src]# cd nginx-1.12.0
    [root@nginx nginx-1.12.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
    
    [root@nginx nginx-1.12.0]# make && make install
    

    nginx安装后配置

    //配置环境变量
    [root@nginx ~]# echo 'export PATH=/usr/local/nginx/sbin:$PATH' > /etc/profile.d/nginx.sh
    [root@nginx ~]# . /etc/profile.d/nginx.sh
    [root@nginx ~]# nginx
    [root@nginx ~]# ss -antl
    State          Recv-Q         Send-Q                 Local Address:Port                 Peer Address:Port         
    LISTEN         0              128                          0.0.0.0:80                        0.0.0.0:*            
    LISTEN         0              128                          0.0.0.0:22                        0.0.0.0:*            
    LISTEN         0              128                             [::]:22                           
    
  • 相关阅读:
    ASP.Net MVC Session和Cookies的简单使用
    MVC基础知识点
    MVC中路由配置
    MVC Controller接受ajax post传输的List<Entity>数据
    《大道至简》第五章读后感
    字符串课后作业
    《大道至简》第四章读后感
    类和对象课后作业
    《大道至简》第三章读后感
    java 语言基础作业
  • 原文地址:https://www.cnblogs.com/Ycqifei/p/14806731.html
Copyright © 2011-2022 走看看