zoukankan      html  css  js  c++  java
  • Nginx优化

    4、Nginx优化

     

    http://www.mamicode.com/info-detail-1951533.html

    4.1、规范优化Nginx配置文件:

    Nginx的主配置文件为nginx.conf,主配置文件包含所有虚拟主机的子配置文件同一放到extra目录中。

    虚拟主机的配置文件按照网站的域名或功能取名。

    使用include包含到Nginx主配置文件。

    优化后示例:

    mkdir /application/nginx/extra     #创建虚拟主机配置文件目录

    vim /application/nginx/conf/nginx.conf      #Nginx主配置文件

    worker_processes  1;

    events {

        worker_connections  1024;

    }

    http {

        include       mime.types;

        default_type  application/octet-stream;

        sendfile        on;

        keepalive_timeout  65;

        include ../extra/www.conf;             #包含虚拟主机配置文件

        include ../extra/bbs.conf;             #包含虚拟主机配置文件

        include ../extra/pan.conf;             #包含虚拟主机配置文件

    }

     

    vim /application/nginx/extra/www.conf      #虚拟主机配置文件

    server {

            listen       192.168.30.3;

            server_name  www.smartbro.com;

            location / {

                root   html/www;

                index  index.html index.htm;

            }

    }

     

    vim /application/nginx/extra/bbs.conf      #虚拟主机配置文件

    server {

            listen       192.168.20.3;

            server_name  bbs.smartbro.com;

            location / {

                root   html/bbs;

                index  index.html index.htm;

            }

    }

     

    vim /application/nginx/extra/pan.conf      #虚拟主机配置文件

    server {

            listen       192.168.10.3;

            server_name  pan.smartbro.com;

            location / {

                root   html/pan;

                index  index.html index.htm;

            }

    }

     

    /application/nginx/sbin/nginx -t           #检查配置文件

    nginx: the configuration file /application/nginx-1.13.4//conf/nginx.conf syntax is ok

    nginx: configuration file /application/nginx-1.13.4//conf/nginx.conf test is successful

    /application/nginx/sbin/nginx -s reload    #平滑重启Nginx

     

  • 相关阅读:
    自定义属性的操作 element.属性 以及 element.getAttribute('属性') 获取、自定义方法以及修改值
    鼠标点击、经过,离开案例
    水平垂直居中方法 flex和table-cell区别 父盒子使用定位 水平方向、垂直方向上是否受到影响?
    关于margin 和 margin auto
    python基础
    实验二流程图
    关于实验二的补充(面向对象的程序设计)
    树的重心 POJ_1655
    KMP板子题
    Educational Codeforces Round 62 (Rated for Div. 2) 2019年3月23日
  • 原文地址:https://www.cnblogs.com/domi22/p/9095988.html
Copyright © 2011-2022 走看看