nginx 配置文件存放思路

闲来没事记录下nginx配置文件存放思路

将不同域名的配置存在不同的配置文件中
/etc/nginx/conf.d

-rw-r--r-- 1 root root 329 Apr 14  2019 jenkins.conf
-rw-r--r-- 1 root root 334 Jul 14  2019 monitor.conf
-rw-r--r-- 1 root root 736 Sep 22 18:18 test_gateway.conf
-rw-r--r-- 1 root root 853 Dec  1 16:48 test_h5.conf
  

查看 test_h5.conf 文件

server {
   server_name  test.h5.xxxxxxxxxxx.com;
   root         /usr/local/nginx/html;

    gzip on;
    gzip_static on;
    gzip_min_length 1k;
    gzip_comp_level 4;
    gzip_proxied any;
    gzip_types text/plain text/xml text/css;
    gzip_vary on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";

   location / {
      root   /opt/xxxxxx/frontend/testh5;
      index  index.html;
   }

   location ^~/proxy/ {
      proxy_pass http://127.0.0.1:8888/;
      proxy_set_header    X-Real-IP $remote_addr;
      proxy_set_header    X-Forwarded-Host $remote_addr;
      proxy_set_header    X-Forwarded-Server $remote_addr;
      proxy_set_header    X-Forwarded-For  $remote_addr;
    }

      error_page 404 /404.html;
          location = /40x.html {
      }

      error_page 500 502 503 504 /50x.html;
          location = /50x.html {
      }

    listen 80;

}

上一篇:wordpress | 网站访问速度优化方案


下一篇:Linux压缩与解压缩