nginx生产配置

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;
    }
}

  

时间: 2024-07-30 06:18:32

nginx生产配置的相关文章

一个完整的nginx生产配置示例

user                              nobody nobody; worker_processes                  4; worker_rlimit_nofile              51200; error_log                         logs/error.log  notice; pid                               /var/run/nginx.pid; events { us

Ubuntu12环境下Thin+rails(4)+ruby(2)+nginx+mysql 配置

Ubuntu12环境下Thin+rails(4)+ruby(2)+nginx+mysql配置 1.        前提条件:已经正确安装了ubuntu12并且更行了源. 2.        安装过程: 2.1 安装ruby前的准备: 1.1修改 /etc/apt/sources.list文件改为mirrors.163.com 保存退出 执行命令:  sudo apt-get update 更新源 1.2 安装curl 执行命令:sudoapt-get install curl 1.3 安装rvm

图文解说:Nginx+tomcat配置集群负载均衡

开发的应用采用F5负载均衡交换机,F5将请求转发给5台hp unix服务器,每台服务器有多个webserver实例,对外提供web服务和socket等接口服务.之初,曾有个小小的疑问为何不采用开源的apache.Nginx软件负载,F5设备动辄几十万,价格昂贵?自己一个比较幼稚的问题,后续明白:F5是操作于IOS网络模型的传输层,Nginx.apache是基于http反向代理方式,位于ISO模型的第七层应用层.直白些就是TCP UDP 和http协议的区别,Nginx不能为基于TCP协议的应用提

nginx全局配置和性能优化

nginx目录结构和命令 1.ls /apps/nginx/:         html是测试页,sbin是主程序 2.ls /apps/nginx/sbin/:  nginx 只有一个程序文件 3.ls /apps/nginx/html/:  50x.html index.html 测试网页 ?nginx:默认为启动nginx -h 查看帮助选项 -V 查看版本和配置选项 -t 测试nginx语法错误 -c filename 指定配置文件(default: /etc/nginx/nginx.c

linux下Nginx配置文件(nginx.conf)配置设置详解(windows用phpstudy集成)

linux备份nginx.conf文件举例: cp /usr/local/nginx/nginx.conf /usr/local/nginx/nginx.conf-20171111(日期) 在进程列表里 面找master进程,它的编号就是主进程号. ps -ef | grep nginx 查看进程 cat /usr/local/nginx/nginx.pid 每次修改完nginx文件都要重新加载配置文件linux命令: /usr/local/nginx -t //验证配置文件是否合法 若ngin

nginx安装配置

一.下载Nginx源文件 进入nginx官网下载nginx的稳定版本,我下载的是1.10.0. 下载:wget http://nginx.org/download/nginx-1.10.0.tar.gz 解压:tar -zxvf nginx-1.10.0.tar.gz 二.检查安装依赖项 执行下面的命令安装nginx的依赖库: yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel11 三.配置Nginx安

FastDFS的php和nginx模块配置

一.FastDFS和php整合 1.安装php # 安装依赖包 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel cu

Nginx下配置ThinkPHP的URL Rewrite模式和pathinfo模式支持

前面有关于lnmp环境的搭建,在此就不在赘述.下面就简述thinkPHP如何在nginx下开启url_rewrite和pathinfo模式支持 主要有两个步骤: 一.更改php.ini将;cgi.fix_pathinfo=0  改为cgi.fix_pathinfo=1 二.更改nginx配置文件中php的location设置pathinfo模式: location ~ \.php { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index in

dva+antd写的一个react例子--服务器nginx 的配置

location ^~ /crm { rewrite ^/crm/(.*)(\.js|\.css|\.png|\.jpg|\.jpeg|\.gif|index\.php|robots\.txt)$ /$1$2 break; rewrite .* /index.html break; root /etc/nginx/static2/CIF_crm-frontend/dist/crm/; } 以上是nginx的配置 { "entry": "src/index.js",