• nginx 笔记


    ubuntu  安装卸载

       sudo apt-get update
       sudo apt-get install nginx
    卸载
      源码安装的卸载方式
       rm -rf /etc/nginx/
       rm -rf /usr/sbin/nginx
       rm /usr/share/man/man1/nginx.1.gz
       apt-get remove nginx*
    

      

        sudo apt-get remove nginx nginx-common # 卸载删除除了配置文件以外的所有文件。
    
        sudo apt-get purge nginx nginx-common # 卸载所有东东,包括删除配置文件。
    
        sudo apt-get autoremove # 在上面命令结束后执行,主要是卸载删除Nginx的不再被使用的依赖包。
    
        sudo apt-get remove nginx-full nginx-common #卸载删除两个主要的包。  

    sudo service nginx restart #重启nginx

     

    ps aux|grep nginx在虚拟环境下安装uwsgipip install uwsgi
    ######启动Nginx服务 [root@typecodes ~]# service nginx start ######停止Nginx服务 [root@typecodes ~]# service nginx stop ######重启Nginx服务 [root@typecodes ~]# service nginx restart
    ######Nginx服务的状态 [root@typecodes ~]# service nginx status ######在Nginx服务启动的状态下,重新加载nginx.conf这个配置文件 [root@typecodes ~]# service nginx reload

     源码编译

    编译之前 确认 gcc openssl-devel pcre-devel zlib-devel

    #进入到nginx-1.10.1 ,并配置nginx cd nginx-1.10.1 #配置nginx #--prefix 指定安装的目录 #/usr/local/nginx 是安装目录,不能和自己下载的文件目录重了 #./configure --prefix=/usr/local/nginx #带ssl stub_status模块 添加strem模块 –with-stream,这样就能传输tcp协议了 #http_stub_status_module 状态监控 #http_ssl_module 配置https #stream 配置tcp得转发 #http_gzip_static_module 压缩 #http_sub_module 替换请求 ./configure --prefix=/usr/local/nginx --with-http_stub_status_module




    =========================
    sudo make && make install //会将 nginx 整个有用的东西都会 copy到 上面指定到目录 --prefix=
    ==========================

    编译ok 后 进入obj 目录 其中有一个 nginx-module.c中有一个数组 可以看到其 有哪些模块 被编译进入 到nginx 中



    nginx  -t  -c  /etc/nginx/nginx.conf  //nginx 检查配置语法是否正确

      

     这里就是 nginx  默认的主配置目录   两个 只有一个是    因为  default.conf  有些版本不一定有该文件

    /etc/nginx/nginx.conf
    /etc/nginx/conf.d/default.conf	  这两个都是 主配置文件目录	 nginx主配置文件
    

      

    var/cache/nginx/    目录    nginx的缓存目录
    /var/log/nginx/            目录    nginx的日志目录

    ==================================

    nginx 反向代理  以及使用反响代理进行缓存资源

    使用 goaccess  将nginx 中 access.log 日志 生成 html 文件用来网页可视化 监控!!!!

    ==================================

    nginx.conf  配置中还可以通过  include 来进行嵌套定义配置 文件的路径

    nginx.conf 配置文件

    #设定http 服务  可以利用它的反响代理功能提供负载均衡支持

    http{

          include   mime.type  #设定mime类型 类型由mime.type文件定义   可以cat nginx/conf/mime.types   查看支持那些类型

          default——type  application/octet-strem  默认的mime类型   application/octet-stream指的是二进制流

    nginx中有请求内存池  和链接 内存池  注意区分和使用

    nginx跨进程通信 使用了 共享内存这种 进程间通信的机制 

    需要对连接数量请求 和 请求都进行配置   

    搞清楚 连接数量 和 请求数 都两者却别 http1  http1.1  http2.0  就是对这些进行了优化了两者的关系

    安装压测工具 ab 对nginx 进行压测  检验nginx 配置项是否 ok

    sudo apt-get install apache2-utils  安装ab

    ab -n 100 -c 10 http://www.baidu.com/  压测命令替换

    https://www.cnblogs.com/yjf512/archive/2012/05/10/2494635.html   nginx  gdb设置 为debug 模式

  • 相关阅读:
    【网易官方】极客战记(codecombat)攻略-地牢-健忘的宝石匠
    【网易官方】极客战记(codecombat)攻略-地牢-深藏的宝石
    【网易官方】极客战记(codecombat)攻略-地牢-Kithgard 地牢
    【网易官方】极客战记(codecombat)攻略[地牢]:祸之火焰-通关代码及讲解
    spring可以接收的正则的方式
    Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'
    EnableRetry
    https://www.youtube.com/watch?v=kwuu1efzkf4 38分
    https://gitee.com/createmaker/reactor-examples reactor编程代码
    webflux 20201011
  • 原文地址:https://www.cnblogs.com/zhangkele/p/13364067.html
Copyright © 2020-2023  润新知