主配置文件nginx.conf

  1. user nginx; #设置nginx服务的系统使用用户
  2. worker_processes 1; #工作进程数(和cpu核心数保持一致)
  3. error_log /var/log/nginx/error.log warn; #nginx的错误日志
  4. pid /var/run/nginx.pid; #nginx服务启动时候pid
  5. events {
  6. worker_connections 1024; #每个进程允许最大连接数
  7. }
  8. http {
  9. include /etc/nginx/mime.types;
  10. default_type application/octet-stream;
  11. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  12. '$status $body_bytes_sent "$http_referer" '
  13. '"$http_user_agent" "$http_x_forwarded_for"';
  14. access_log /var/log/nginx/access.log main;
  15. sendfile on;
  16. #tcp_nopush on;
  17. keepalive_timeout 65;
  18. #gzip on;
  19. include /etc/nginx/conf.d/*.conf;
  20. }

设置的配置文件

  1. server {
  2. listen 80;
  3. server_name localhost;
  4. #charset koi8-r;
  5. #access_log /var/log/nginx/host.access.log main;
  6. location ~ \.(html|ico|txt|js|css|ttf)$ {
  7. # html不缓存
  8. add_header Cache-Control no-store;
  9. root /data/node/dist;
  10. }
  11. location / {
  12. root /usr/share/nginx/html;
  13. index index.html index.htm;
  14. }
  15. #error_page 404 /404.html;
  16. # redirect server error pages to the static page /50x.html
  17. #
  18. error_page 500 502 503 504 /50x.html;
  19. location = /50x.html {
  20. root /usr/share/nginx/html;
  21. }
  22. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  23. #
  24. #location ~ \.php$ {
  25. # proxy_pass http://127.0.0.1;
  26. #}
  27. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  28. #
  29. #location ~ \.php$ {
  30. # root html;
  31. # fastcgi_pass 127.0.0.1:9000;
  32. # fastcgi_index index.php;
  33. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  34. # include fastcgi_params;
  35. #}
  36. # deny access to .htaccess files, if Apache's document root
  37. # concurs with nginx's one
  38. #
  39. #location ~ /\.ht {
  40. # deny all;
  41. #}
  42. }

Nginx配置文件模板的更多相关文章

  1. Nginx 配置文件模板

    user www www; worker_processes 2; error_log /usr/local/nginx/logs/nginx_error.log crit; pid /usr/loc ...

  2. Etcd+Confd实现Nginx配置文件自动管理

    一.需求 我们使用Nginx做七层负载均衡,后端是Tomcat.项目采用灰度发布方式,每次项目升级,都要手动先从Nginx下摘掉一组,然后再升级这组,当项目快速迭代时,手动做这些操作显然会增加部署时间 ...

  3. nginx配置模板问题404

    nginx配置模板问题 一.nginx主配置文件如下 cat /etc/nginx/nginx.conf user nginx; worker_processes ; #error_log logs/ ...

  4. Nginx配置文件nginx.conf中文详解(转)

    ######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_ ...

  5. 查看nginx配置文件路径

    进入nginx安装目录(我的是/usr/local/nginx-1.7.8/) 进入sbin目录,输入 ./nginx -t查看nginx配置文件路径以及该文件语法是否正确 ./nginx -v查看n ...

  6. Nginx配置文件详解

    Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. ######Nginx配置文件nginx.conf中文详解##### #定义Ngin ...

  7. 005.nginx配置文件

    1.替换nginx主配置文件 通过前面的配置,LNMP的环境已经搭建完成,现在我们替换nginx配置文件: [root@huh ~]# cd /usr/local/nginx/conf/[root@h ...

  8. nginx配置文件nginx.conf超详细讲解

    #nginx进程,一般设置为和cpu核数一样worker_processes 4;                        #错误日志存放目录 error_log  /data1/logs/er ...

  9. 通过nginx配置文件抵御攻击

    通过nginx配置文件抵御攻击 囧思九千 · 2013/11/12 12:22 0x00 前言 大家好,我们是OpenCDN团队的Twwy.这次我们来讲讲如何通过简单的配置文件来实现nginx防御攻击 ...

随机推荐

  1. redis常用指令总结以及功能介绍

    第一部分 redis的常用指令 一.针对key的操作 1.1 del key [key .. ]                 , 删除指定的一个或者多个key;1.2 dump key       ...

  2. C# 将 Begin 和 End 异步方法转 task 异步

    在 .NET Framework 有两个不同的异步方法,一个是 Asynchronous Programming Model (APM) 另一个是 Task-based asynchronous pa ...

  3. CodeForces Goodbye 2017

    传送门 A - New Year and Counting Cards •题意 有n张牌,正面有字母,反面有数字 其中元音字母$a,e,o,i,u$的另一面必须对应$0,2,4,6,8$的偶数 其他字 ...

  4. STVD、IAR两种编译器比较

    1.全局查找功能: STVD:全局查找功能全局查找功能比较麻烦,有3个动作. IAR:有全局查找功能比较方便,只要一个动作,和KEIL一样. 2.编译时间 STVD:相对比较慢. IAR:相对快点. ...

  5. 在Android上为所欲为的一些技术

    https://www.jianshu.com/p/87ce6f565d37Android JNI(一)——NDK与JNI基础 https://www.android-doc.com/guide/co ...

  6. Redis安装(单机及各类集群,阿里云)

    Redis安装(单机及各类集群,阿里云) 前言 上周,我朋友突然悄悄咪咪地指着手机上的一篇博客说,这是你的博客吧.我看了一眼,是之前发布的<Rabbit安装(单机及集群,阿里云>.我朋友很 ...

  7. Java图形打印 上下对称三角星

    记录记录 @Test public void name03() { int row = 9; for (int i=0,k=row,m=0;i< row;i++){ for(int l=m-i; ...

  8. mysql 时间函数总结

    1. 获取当前时间   select now(); // 2018-08-24 11:01:26   select unix_timestamp(); // 1535079695   总结:unix_ ...

  9. Gif动图压缩java版

    简单说明下,如果不是压缩动图的话只用java本身的包足够实现压缩和截取图片了,为了能够压缩gif动图,这里引用了两个文件 AnimatedGifEncoder 和 GifDecoder, 先用Deco ...

  10. 轻松搭建基于 SpringBoot + Vue 的 Web 商城应用

    背景介绍 首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传.函数 ...