user  www www;

worker_processes 2;

error_log  /usr/local/nginx/logs/nginx_error.log  crit;

pid        /usr/local/nginx/logs/nginx.pid;

#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200; events
{
use epoll;
worker_connections 51200;
} http
{
include mime.types;
default_type application/octet-stream; server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m; sendfile on;
tcp_nopush on; keepalive_timeout 60; tcp_nodelay on; fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k; gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on; #limit_zone crawler $binary_remote_addr 10m; log_format accesslog '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';
access_log /data/nginxlogs/accesslog.log accesslog; include conf.d/*.conf;
}

以上是  nginx.conf 主配置文件

2. 站点 test.conf

server
{
listen 80;
server_name test.cn;
index index.html index.htm index.php;
root /web/web/test.cn; location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} location /status {
stub_status on;
access_log off;
} location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)${
expires 30d;
} location ~ .*\.(js|css)?${
expires 12h;
} }

建一个conf.d文件夹,复制test.conf  改一下servername,root 就是另一个站点。

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

  1. Nginx配置文件模板

    主配置文件nginx.conf user nginx; #设置nginx服务的系统使用用户 worker_processes 1; #工作进程数(和cpu核心数保持一致) error_log /var ...

  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. Java Hour 49 保存和查询历史的Weather

    吾一直坚信,是需求的不断变化推动了架构的不断演变. 新的需求 能够查看指定日期的Weather,因为客户想要比较昨天和今天的天气情况,所以需要能够查询历史数据的功能. 1 能保存当前的天气到数据库 2 ...

  2. html5 视频播放

    html5 视频播放 <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...

  3. Android利用调试器调试程序

    首先,通过在AndroidManifest.xml文件中添加android:debuggable=”true”选项, <application android:icon=”@drawable/i ...

  4. loj 1009(dfs)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=25835 思路:对每一个连通块将其染色,然后取颜色相同的最多的点,最 ...

  5. js:语言精髓笔记8--对象系统

    封装: 一把对象系统,封装是由语法解析来实现的,即语法作用域:但js是动态语言,因此只能依赖变量作用域: js的变量作用域只有表达式,函数,全局三种:所以js只能实现public和private两种封 ...

  6. 解决Fiddler无法抓到手机的会话包

    解决Fiddler无法抓到手机的会话包   使用Fiddler抓手机的会话包涉及多个方面,所以容易出现无法抓取包的情况.遇到这类问题,需要按照以下顺序进行检查和排除.   (1)在Fiddler中设置 ...

  7. LIS HDOJ 1257 最少拦截系统

    题目传送门 题意:中文题面 分析:LIS模板题:n - 最长下降子序列 -> 最长上升子序列 贪心做法以后再补:) 代码: #include <cstdio> #include &l ...

  8. BZOJ3738 : [Ontak2013]Kapitał

    $C_{N+M}^N=\frac{(N+M)!}{N!M!}$ 考虑求出$ans\bmod 10^9$的值 $10^9=2^9\times5^9$ 以$2^9$为例,先预处理出$1$..$2^9$中不 ...

  9. 【wikioi】1403 新三国争霸(dp+kruskal)

    http://wikioi.com/problem/1403/ 一开始的确感觉和bzoj1003很像,不同的是这里还要求联通,求最小的边. 我们可以想到用最小生成树(为嘛我自己想不到呢..) 我们可以 ...

  10. Idea_编译报错 javacTask: 源发行版 1.6 需要目标发行版 1.6

    在idea中编译时发生如下的错误 Information:Using javac 1.7.0_75 to compile java sources Information:java: javacTas ...