Nginx配置文件模板
主配置文件nginx.conf
user nginx; #设置nginx服务的系统使用用户
worker_processes 1; #工作进程数(和cpu核心数保持一致)
error_log /var/log/nginx/error.log warn; #nginx的错误日志
pid /var/run/nginx.pid; #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;
}
设置的配置文件
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location ~ \.(html|ico|txt|js|css|ttf)$ {
# html不缓存
add_header Cache-Control no-store;
root /data/node/dist;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
Nginx配置文件模板的更多相关文章
- Nginx 配置文件模板
user www www; worker_processes 2; error_log /usr/local/nginx/logs/nginx_error.log crit; pid /usr/loc ...
- Etcd+Confd实现Nginx配置文件自动管理
一.需求 我们使用Nginx做七层负载均衡,后端是Tomcat.项目采用灰度发布方式,每次项目升级,都要手动先从Nginx下摘掉一组,然后再升级这组,当项目快速迭代时,手动做这些操作显然会增加部署时间 ...
- nginx配置模板问题404
nginx配置模板问题 一.nginx主配置文件如下 cat /etc/nginx/nginx.conf user nginx; worker_processes ; #error_log logs/ ...
- Nginx配置文件nginx.conf中文详解(转)
######Nginx配置文件nginx.conf中文详解##### #定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数. worker_ ...
- 查看nginx配置文件路径
进入nginx安装目录(我的是/usr/local/nginx-1.7.8/) 进入sbin目录,输入 ./nginx -t查看nginx配置文件路径以及该文件语法是否正确 ./nginx -v查看n ...
- Nginx配置文件详解
Nginx是一款面向性能设计的HTTP服务器,相较于Apache.lighttpd具有占有内存少,稳定性高等优势. ######Nginx配置文件nginx.conf中文详解##### #定义Ngin ...
- 005.nginx配置文件
1.替换nginx主配置文件 通过前面的配置,LNMP的环境已经搭建完成,现在我们替换nginx配置文件: [root@huh ~]# cd /usr/local/nginx/conf/[root@h ...
- nginx配置文件nginx.conf超详细讲解
#nginx进程,一般设置为和cpu核数一样worker_processes 4; #错误日志存放目录 error_log /data1/logs/er ...
- 通过nginx配置文件抵御攻击
通过nginx配置文件抵御攻击 囧思九千 · 2013/11/12 12:22 0x00 前言 大家好,我们是OpenCDN团队的Twwy.这次我们来讲讲如何通过简单的配置文件来实现nginx防御攻击 ...
随机推荐
- redis常用指令总结以及功能介绍
第一部分 redis的常用指令 一.针对key的操作 1.1 del key [key .. ] , 删除指定的一个或者多个key;1.2 dump key ...
- C# 将 Begin 和 End 异步方法转 task 异步
在 .NET Framework 有两个不同的异步方法,一个是 Asynchronous Programming Model (APM) 另一个是 Task-based asynchronous pa ...
- CodeForces Goodbye 2017
传送门 A - New Year and Counting Cards •题意 有n张牌,正面有字母,反面有数字 其中元音字母$a,e,o,i,u$的另一面必须对应$0,2,4,6,8$的偶数 其他字 ...
- STVD、IAR两种编译器比较
1.全局查找功能: STVD:全局查找功能全局查找功能比较麻烦,有3个动作. IAR:有全局查找功能比较方便,只要一个动作,和KEIL一样. 2.编译时间 STVD:相对比较慢. IAR:相对快点. ...
- 在Android上为所欲为的一些技术
https://www.jianshu.com/p/87ce6f565d37Android JNI(一)——NDK与JNI基础 https://www.android-doc.com/guide/co ...
- Redis安装(单机及各类集群,阿里云)
Redis安装(单机及各类集群,阿里云) 前言 上周,我朋友突然悄悄咪咪地指着手机上的一篇博客说,这是你的博客吧.我看了一眼,是之前发布的<Rabbit安装(单机及集群,阿里云>.我朋友很 ...
- Java图形打印 上下对称三角星
记录记录 @Test public void name03() { int row = 9; for (int i=0,k=row,m=0;i< row;i++){ for(int l=m-i; ...
- mysql 时间函数总结
1. 获取当前时间 select now(); // 2018-08-24 11:01:26 select unix_timestamp(); // 1535079695 总结:unix_ ...
- Gif动图压缩java版
简单说明下,如果不是压缩动图的话只用java本身的包足够实现压缩和截取图片了,为了能够压缩gif动图,这里引用了两个文件 AnimatedGifEncoder 和 GifDecoder, 先用Deco ...
- 轻松搭建基于 SpringBoot + Vue 的 Web 商城应用
背景介绍 首先介绍下在本文出现的几个比较重要的概念: 函数计算(Function Compute): 函数计算是一个事件驱动的服务,通过函数计算,用户无需管理服务器等运行情况,只需编写代码并上传.函数 ...