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. hdu 1106:排序(水题,字符串处理 + 排序)

    排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...

  2. POJ2735/Gym 100650E Reliable Nets dfs

    Problem E: Reliable NetsYou’re in charge of designing a campus network between buildings and are ver ...

  3. 用戶登陸。防SQL注入,驗證碼不區分大小寫

    if (string.Compare(TBCheckCode.Text, Session["CheckCodeI"].ToString(), true) == 0)        ...

  4. 开始写github

    公司即将开发手机钱庄网,于是最近在写一些手机上常用的js组件做前期准备. 之所以没有沿用pc的那些插件,原因是: 之前的插件大多数是使用jquery写的 移动端的性能要求更严格 以前写的插件从现在看看 ...

  5. LIST_ENTRY

    一个常见的 Windows 2000 数据类型是 LIST_ENTRY 结构.内核使用该结构将所有对象维护在一个双向链表中.一个对象分属多个链表是很常见的, Flink 成员是一个向前链接,指向下一个 ...

  6. 贪心 POJ 2109 Power of Cryptography

    题目地址:http://poj.org/problem?id=2109 /* 题意:k ^ n = p,求k 1. double + pow:因为double装得下p,k = pow (p, 1 / ...

  7. Revit二次开发示例:EventsMonitor

    在该示例中,插件在Revit启动时弹出事件监控选择界面,供用户设置,也可在添加的Ribbon界面完成设置.当Revit进行相应操作时,弹出窗体会记录事件时间和名称. #region Namespace ...

  8. DevExpress DXperience 的ASPxFilterControl 不显示 Like 菜单的方法

    当使用Linq 作为数据源时,如果使用 ASPxFilterControl 的 Like 菜单筛选数据,就会出现以下错误 LINQ to Entities does not recognize the ...

  9. 走楼梯[XDU1031]

    Problem 1031 - 走楼梯 Time Limit: 1000MS   Memory Limit: 65536KB   Difficulty: Total Submit: 724  Accep ...

  10. extjs 动态添加item

    <html> <p> </p> <head> <title>测试页面</title> <meta http-equiv=& ...