[原]生产环境下的nginx.conf配置文件(多虚拟主机)

2013-12-27阅读110 评论0

我的生产环境下的nginx.conf配置文件,做了虚拟主机设置的,大家可以根据需求更改,下载即可在自己的机器上使用了,本配置文件摘录自《构建高可用Linux服务器》(机械工业出版社),转载麻烦注明出处,谢谢,配置文件如下:

user  www www;
worker_processes 8;
error_log  /data/logs/nginx_error.log  crit;
pid        /usr/local/webserver/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 65535;
events
{
  use epoll;
  worker_connections 65535;
}
http
{
  include       mime.types;
  default_type  application/octet-stream;
  #charset  gb2312;
  server_names_hash_bucket_size 128;
  client_header_buffer_size 32k;
  large_client_header_buffers 4 32k;
  client_max_body_size 8m;
  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 128k;
  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;
  server
  {
    listen 80 default;
    server_name _;
    index index.html index.htm index.php;
    root /data/htdocs/www;
    #server_name_in_redirect off;
    location ~ .*\.(php|php5)?$
    {
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }
    }
  server
  {
    listen       80;
    server_name  www.adongstudio.com;
    index index.html index.htm index.php;
    root  /data/htdocs/www/adongweb;
    #limit_conn   crawler  20;   
    location ~ .*\.(php|php5)?$
    {     
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }   
    log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
              '$status $body_bytes_sent "$http_referer" '
              '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/access.log  access;
      }
  server
  {
    listen       80;
    server_name  www.longfeistudio.com;
    index index.html index.htm index.php;
    root  /data/htdocs/www/ImageVue;
    #limit_conn   crawler  20;
    location ~ .*\.(php|php5)?$
    {
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }
    access_log  off;
      }
  server
  {
    listen       80;
    server_name  www.hongyanbike.com;
    index index.html index.htm index.php;
    root  /data/htdocs/www/xhui/hybike;
    location ~ .*\.(php|php5)?$
    {     
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }
    access_log  off;
  }
server
  {
    listen       80;
    server_name  www.very365.com mm.very365.com very365.com;   
    index index.html index.htm index.php;
    root  /data/htdocs/www/very365;  
  location /
  {    
  rewrite ^/(.*)/product/([0-9]+)/$ /seoproduct\.php\?spell=$1&productid=$2;
  rewrite ^/brand/(.*)/page/([0-9]+)/$ /seobrand\.php\?spell=$1&page=$2;
  rewrite ^/brand/(.*)/$ /seobrand\.php\?spell=$1;
    }
    location ~ .*\.(php|php5)?$
    {
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
      fastcgi_param SCRIPT_FILENAME /data/htdocs/www/very365$fastcgi_script_name;
      fastcgi_param  SCRIPT_NAME  /data/htdocs/www/very365$fastcgi_script_name;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }
    access_log  off;
  }
server
  {
    listen       80;
    server_name  www.wqueen.cn wqueen.cn;
    index index.html index.htm index.php;
    root  /data/htdocs/www/wqueen/bbs;
    location ~ .*\.(php|php5)?$
    {
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }
    access_log  off;
    }
server
  {
    listen       80;
    server_name  baobei.wqueen.cn;
    index index.html index.htm index.php;
    root  /data/htdocs/www/baobei;
    location ~ .*\.(php|php5)?$
    {
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
      expires      30d;
    }
    location ~ .*\.(js|css)?$
    {
      expires      1h;
    }
    access_log  off;
    }
}

[原]生产环境下的nginx.conf配置文件(多虚拟主机)的更多相关文章

  1. Apache httpd.conf配置文件 3(虚拟主机)

    ### Section 3: Virtual Hosts 第三部分 虚拟主机 注意:在使用虚拟主机前,请先检查  http.conf 的 辅助配置文件httpd-vhosts.conf 是否注释 # ...

  2. 生产环境下Flask项目目录构建

    接触Flask已经有大半年了,本篇博客主要来探讨如何规范化生产环境下Flask的项目目录结构.虽然目录结构见仁见智,个人有个人的看法和习惯,但总的来说,经过很多人的实践和总结,还是有很多共同的意见和想 ...

  3. 生产环境下lnmp的权限说明

    https://www.cnblogs.com/zrp2013/p/4183546.html 有关权限说明:-rwxrw-r‐-1 root root 1213 Feb 2 09:39 50.html ...

  4. Centos7环境下使用Nginx托管.Net Core应用程序

    一.安装.Net Core 参考官方文档:https://www.microsoft.com/net/core#linuxcentos 1.添加dotnet产品Feed 在安装.NET Core之前, ...

  5. centos7生产环境下openssh升级

    由于生产环境ssh版本太低,导致使用安全软件扫描时提示系统处于异常不安全的状态,主要原因是ssh漏洞.推荐通过升级ssh版本修复漏洞 因为是生产环境,所以有很多问题需要注意.为了保险起见,在生产环境下 ...

  6. CentOS 环境下基于 Nginx uwsgi 搭建 Django 站点

    因为我的个人网站 restran.net 已经启用,博客园的内容已经不再更新.请访问我的个人网站获取这篇文章的最新内容,CentOS 环境下基于 Nginx uwsgi 搭建 Django 站点 以下 ...

  7. Linux和Windows环境下安装Nginx

    Nginx的安装 windows环境下安装Nginx 安装 Nginx 的下载地址如下: http://nginx.org/en/download.html 选择时尽量选择 Stable 稳定版本,点 ...

  8. Python开发程序:生产环境下实时统计网站访问日志信息

    日志实时分析系统 生产环境下有需求:要每搁五分钟统计下这段时间内的网站访问量.UV.独立IP等信息,用直观的数据表格表现出来 环境描述: 网站为Nginx服务,系统每日凌晨会对日志进行分割,拷贝到其他 ...

  9. Mysql迁移工具在生产环境下的使用

    在产品迭代开发发布过程中,由于业务需求的增加,数据库难免会有结构调整等操作. 在每个版本发布过程中怎么控制每个版本server端程序与数据库版本保持一致,以及数 据库升级.回滚等操作. 本博文宅鸟将向 ...

随机推荐

  1. HDU 4609 3-idiots FFT+容斥

    一点吐槽:我看网上很多分析,都是在分析这个题的时候,讲了半天的FFT,其实我感觉更多的把FFT当工具用就好了 分析:这个题如果数据小,统计两个相加为 x 的个数这一步骤(这个步骤其实就是求卷积啊),完 ...

  2. XTUOJ1247 Pair-Pair 预处理+暴力

    分析:开个1000*1000的数组,预处理矩阵和,然后分类讨论就好 时间复杂度:O(n) #include <cstdio> #include <iostream> #incl ...

  3. Apache OFBiz 学习笔记 之 服务引擎 一

    概述     服务定义为一段独立的逻辑顺序,当多个服务组合一起时可完成不同类型的业务需求     服务有很多类型,WorkFlow.Rules.Java.SOAP.BeanShell等.java类型的 ...

  4. 完全参照系统自带的DatePickerDialog、TimePickerDialog的源代码仿写的DateTimePickerDialog

    完全参照系统自带的DatePickerDialog.TimePickerDialog的源代码仿写的DateTimePickerDialog.具有同时选择日期.时间的功能.在2.2.2.3平台,显示的效 ...

  5. 常见设计模式解析和实现(C++)Prototype模式(原型模式)

    作用:用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. UML结构图: 抽象基类: 1)  Prototype:虚拟基类,所有原型的基类,提供Clone接口函数 接口函数: 1)  P ...

  6. 在ASP.NET下做了一个实验MVC的小东西

    星期五下班前一时兴起,对MVC发表了一点看法.后来就想干脆弄个小东西来验证一些自己的想法帮组理清思路.所要源代码的免了,3个小时的急就章实在是乱得可以,既没有好的架构,也没有任何代码质量可言,主要是实 ...

  7. [算法] 插入排序 Insertion Sort

    插入排序(Insertion Sort)是一种简单直观的排序算法.它的工作原理是通过构建有序序列,对于未排序数据,在已排序序列中从后向前扫描,找到相应位置并插入.插入排序在实现上,通常采用in-pla ...

  8. 《Genesis-3D开源游戏引擎-官方录制系列视频教程:基础操作篇》

    注:本系列教程仅针对引擎编辑器:v1.2.2及以下版本 G3D基础操作   第一课<G3D编辑器初探> G3D编辑器介绍,依托于一个复杂场景,讲解了场景视图及其基本操作,属性面板和工具栏的 ...

  9. 个人思考:能否sub.prototye=sup.prototype实现继承

    var Sup=function(name){ this.name=name; }; var Sub=function(name){ this.name=name; }; Sup.prototype. ...

  10. Linux下文件的权限

    一.Linux下查看文件属性 命令为: [root@localhost ~]# ls -al 结果: ls是『list』的意思,重点在显示文件的文件名与相关属性.而选项『-al』则表示列出所有的文件详 ...