• nginx的安装步骤


    nginx学习资料;https://zhuanlan.zhihu.com/p/34943332

    1.下载nginx的安装包:https://nginx.org/en/download.html

    2. 进行解压:tar -zxvf  nginx-1.15.1.tar.gz

    3. 进入nginx目录

    4.执行配置命令   ./configure

    5.编译安装        make  install

    6. 查看安装路径;    whereis nginx

    7. 进入nginx目录;  cd /usr/local/nginx

    8. 启动nginx服务      ./nginx  -c  /usr/local/nginx/conf/nginx.conf

    ./nginx              开启
    ./nginx -s stop      停止
    ./nginx -s quit      强制停止
    ./nginx -s  reload   加载配置文件

    ./nginx -s quit:此方式停止步骤是待nginx进程处理任务完毕进行停止。 
    ./nginx -s stop:此方式相当于先查出nginx进程id再使用kill命令强制杀掉进程。

    修改nginx.conf ,要想让配置生效需要重启nginx,使用./nginx -s reload不用先停止nginx再启动,即可将配置信息在nginx中生效。

    9 设置开机自启动

    编辑rc.local 文件添加以下命令 : /usr/local/nginx/sbin/nginx

    10  nginx 的配置文件

    nginx.conf 
     
    #定义Nginx运行的用户和用户组
    #user  nobody;
     
    #nginx进程数,建议设置为等于CPU总核心数。
    worker_processes  1;
     
    #全局错误日志定义类型,[ debug | info | notice | warn | error | crit ]
    error_log  logs/error.log  info;
     
    #进程文件
    pid        logs/nginx.pid;
     
    #工作模式与连接数上限
    events {
        #单个进程最大连接数(最大连接数=连接数*进程数)
        worker_connections  1024;
    }
     
    #设定http服务器
    http {
        #文件扩展名与文件类型映射表
        include       mime.types;
        #默认文件类型
        default_type  application/octet-stream;
    
        #开启高效文件传输模式,sendfile指令指定nginx是否调用sendfile函数来输出文件,对于普通应用设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络I/O处理速度,降低系统的负载。注意:如果图片显示不正常把这个改 成off。
        sendfile        on;
     
        #防止网络阻塞
        tcp_nopush     on;
     
        #长连接超时时间,单位是秒
        keepalive_timeout  65;
     
        #开启gzip压缩输出
        gzip  on;
     
        #虚拟主机的配置
        server {
            #监听端口
            listen       80;
     
            #域名可以有多个,用空格隔开
            server_name  localhost;
     
            #默认编码
            charset utf-8;
     
            #定义本虚拟主机的访问日志
            access_log  logs/host.access.log  main;
     
            location / {
                root   html;
                index  index.html index.htm;
            }
        }
    }
    

      

     
  • 相关阅读:
    Exception: Failed to execute 'setItem' on 'Storage'
    element ui中动态添加的表单进行验证
    10. 自定义assertThat中的Matcher函数lt、gt
    8. anyInt()、anyString()、eq()、anyCollection()、verify验证void方法
    7. 参数匹配:eq、isA、any
    6. spy
    4-5. when-thenXX、doXX-when、Answer、thenCallRealMethod
    2. 开启Mock的三种方式、深度Mook
    1. quickstart
    Sentinel
  • 原文地址:https://www.cnblogs.com/dapingguo/p/10342720.html
Copyright © 2020-2023  润新知