• ngnix随笔二


    ngnix配置文件

    1.rpm -ql nginx

    /etc/logrotate.d/nginx
    /etc/nginx
    /etc/nginx/conf.d
    /etc/nginx/conf.d/default.conf
    /etc/nginx/fastcgi_params
    /etc/nginx/koi-utf
    /etc/nginx/koi-win
    /etc/nginx/mime.types
    /etc/nginx/modules
    /etc/nginx/nginx.conf
    /etc/nginx/scgi_params
    /etc/nginx/uwsgi_params
    /etc/nginx/win-utf
    /etc/sysconfig/nginx
    /etc/sysconfig/nginx-debug
    /usr/lib/systemd/system/nginx-debug.service
    /usr/lib/systemd/system/nginx.service
    /usr/lib64/nginx
    /usr/lib64/nginx/modules
    /usr/libexec/initscripts/legacy-actions/nginx
    /usr/libexec/initscripts/legacy-actions/nginx/check-reload
    /usr/libexec/initscripts/legacy-actions/nginx/upgrade
    /usr/sbin/nginx
    /usr/sbin/nginx-debug
    /usr/share/doc/nginx-1.16.1
    /usr/share/doc/nginx-1.16.1/COPYRIGHT
    /usr/share/man/man8/nginx.8.gz
    /usr/share/nginx
    /usr/share/nginx/html
    /usr/share/nginx/html/50x.html
    /usr/share/nginx/html/index.html
    /var/cache/nginx
    /var/log/nginx

    2. 配置文件

      vim  /etc/nginx/nginx.conf

    #启动nginx的用户
    user  nginx;
    #worker的数量,一般与CPU数量一致 worker  number| auto;
    worker_processes 2;
    #绑定worker与cpu的cpu号  00000001:0号cpu   00000010:2号cpu  00000100:3号cpu...10000000:8号cpu
    worker_cpu_affinity 0001 0001;
    #worker进程的优先级  [-20,20]
    worker_priority 10;
    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;
    
    
    events {
        worker_connections  1024;
    }
    
    
    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;
    
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    
        access_log  /var/log/nginx/access.log  main;
    
        sendfile        on;
        #tcp_nopush     on;
    
        keepalive_timeout  65;
    
        #gzip  on;
    
        include /etc/nginx/conf.d/*.conf;
        #自定义的虚拟主机配置文件,耦合性低方便维护
        include /etc/nginx/conf.d/vhosts/*.conf;
    }
    [root@192 ~]# vim /etc/nginx/conf.d/vhosts/
    a.com.conf  b.com.conf  
    一下以a为例:
    #vim /etc/nginx/conf.d/vhosts/a.com.conf    
    server {
         #监听的端口 listen
    80;
         #服务器名称 server_name www.a.com;
         #主页目录 root /data/vhosts/www.a.com; }

    创建主页目录  

      #mkdir /data/vhosts/www.a.com/ -p
      #mkdir /data/vhosts/www.b.com/ -p

    创建主页

    #echo www.a.com > /data/vhosts/www.a.com/index.html
    #echo www.b.com > /data/vhosts/www.b.com/index.html

    重启nginx即可

  • 相关阅读:
    AndroidUI 控件命名格式
    VoIP常见编码的带宽计算
    Hessian 原理分析
    关于异步,同步,阻塞与非阻塞
    dubbo 官方参考手册~备案(防止哪天阿里一生气把dubbo给删除了)
    企业常用的RPC框架比较
    SpringMVC整合Hessian访问远程服务
    Hessian与Webservice的区别
    Dubbo与Zookeeper、Spring整合使用
    java.lang.ClassNotFoundException: org.I0Itec.zkclient.exception.ZkNoNodeException 异常 如何处理
  • 原文地址:https://www.cnblogs.com/hekuangquanshuiweiteng/p/12726907.html
Copyright © 2020-2023  润新知