`
zxl7049
  • 浏览: 29538 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

以前写过的 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  	utf-8;
      
  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;


  server
  {
    listen       80;
    server_name  mysql.moyea.com;
    index index.html index.htm index.php;
    root  /data/htdocs/phpMyAdmin;

    #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  p.moyea.com;
    index index.html index.htm index.php;
    root  /data/htdocs/;

    location ~ .*\.(php|php5)?$
    {      
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }

    log_format  wwwlogs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/wwwlogs.log  wwwlogs;
    
    }

  server
  {
    listen       80;
    server_name  aunsoft.moyea.com;
    index index.html index.htm index.php;
    root  /data/htdocs/aunsoft;

    location ~ .*\.(php|php5)?$
    {      
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }

    log_format  aunsoftlogs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/aunsoftlogs.log  aunsoftlogs;
    
    }


  server
  {
    listen       80;
    server_name  digishow.moyea.com;
    index  home.php;
    root  /data/htdocs/digishow;
    
    include  digishow.conf;

    location ~ .*\.(php|php5)?$
    {      
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }

    log_format  digishowlogs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/digishowlogs.log  digishowlogs;
    
    }
   
    server
  {
    listen       80;
    server_name  sso.moyea.com;
    index  home.php;
    root  /data/htdocs/sso;
    
    include   sso.conf;

    location ~ .*\.(php|php5)?$
    {      
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }

    log_format  ssologs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/ssologs.log  ssologs;
    
    }
	

    server
  {
    listen       80;
    server_name  pavtube.moyea.com;
    index index.html  usercenter.php;
    root  /data/htdocs/moyea;
    
    include   pavtube.conf;

    location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {
	if (-f $request_filename){
	       access_log   off;
	       expires      7d;
		}	     
        }


   location ~ .*\.(php|php5)?$
    {      
 
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index usercenter.php;
      include fcgi.conf;
    }

    log_format  pavtubelogs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/pavtubelogs.log  pavtubelogs;
  }	


    server
  {
    listen       80;
    server_name  mis.moyea.com;
    index index.html  index.php;
    root  /data/htdocs/mis/www;

   #include   pavtube.conf;

    location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {
        if (-f $request_filename){
               access_log   off;
               expires      7d;
                }
        }


   location ~ .*\.(php|php5)?$
    {

      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index usercenter.php;
      include fcgi.conf;
    }

    log_format  mislogs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/mislogs.log  mislogs;
  }


    server
  {
    listen       80;
    server_name  uc.moyea.com;
    index index.html  index.php;
    root  /data/htdocs/mis/ucenter;

   #include   pavtube.conf;

    location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {
        if (-f $request_filename){
               access_log   off;
               expires      7d;
                }
	}
   location ~ .*\.(php|php5)?$
   {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }

    log_format  uclogs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
    access_log  /data/logs/uclogs.log  uclogs;
  }


  server
  {
    listen       80;
    server_name  ct.moyea.com;
    index index.html  index.php;
    root  /data/htdocs/mis/content;

    location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {
        if (-f $request_filename){
               access_log   off;
               expires      7d;
                }
	}
   location ~ .*\.(php|php5)?$
   {
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
  }

  server
  {
    listen       80;
    server_name  st.moyea.com;
    index index.html  index.php;
    root  /data/htdocs/mis/statis;

    location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {
        if (-f $request_filename){
               access_log   off;
               expires      7d;
                }
        }
   location ~ .*\.(php|php5)?$
         fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      include fcgi.conf;
    }
  }
}



digishow.conf
location / {
	rewrite "^(.*)-([a-zA-Z]+)-([a-zA-Z]+)\.html-(.*)$" /home.php?c=$2&a=$3&$4 last;
	rewrite "^/front-([a-zA-z]+)\.htm$" /home.php?c=front&a=$1 last;
	rewrite "^/home-([a-zA-z]+)\.htm$" /home.php?c=home&a=$1 last;
	rewrite "^/home-([a-zA-z]+)-([0-9]+)\.htm$" /home.php?c=home&a=$1&id=$2 last;
	rewrite "^/front-([a-zA-z]+)-([0-9]+)\.htm$" /home.php?c=front&a=$1&id=$2 last;
	rewrite "^/front-([a-zA-z]+)-page-([0-9]+)\.htm$" /home.php?c=front&a=$1&page=$2 last;
	rewrite "^/front-([a-zA-z]+)-page\.htm(.*)$" /home.php?c=front&a=$1$2 last;
	rewrite "^(.*)admin.php(.*)$" /admin.php?$2 last;
	if ($request_uri ~* (.*)){
		set $zf "0";	
	}

	if ($request_uri ~* "\.(jpg|js|css|ico|gif|png|html|swf|flv)" ) {
		set $zf "1";
	}

	if ($zf ~ "0") {
		rewrite (.*) /home.php last;
	}
	error_page   404  http://digishow.moyea.com/404.html ;
        error_page   500  http://digishow.moyea.com/500.html ;
}

location ~* ^.+\.(js|ico|gif|jpg|jpeg|pdf|png|css)$ {
	if (-f $request_filename){
	       access_log   off;
	       expires      7d;
	}
 location ~* ^.+\.(ico|gif|jpg|jpeg)$ {
	if (!-f $request_filename){
		error_page 404 /data/bigDefault.jpg; 
		break; 
	}
	}
   }
location ~ ^/(app|libs|comm)/ {
	deny all;
	break;
}
	




分享到:
评论

相关推荐

    Nginx使用方法

    nginx -t -c F:/nginx-1.12.2/conf/nginx.conf 测试nginx配置文件是否正确 start nginx nginx -s stop nginx -s quit nginx -s reload nginx -t 修改后的hosts文件放入c:\windows\system32\drivers\etc替换以前的...

    NGINX-WP-Rocket:NGINX最佳WordPress性能增强器配置-WP Rocket Rock ..

    它使Nginx可以直接提供以前缓存的文件,而无需调用WordPress或任何PHP。 它还添加了标头来缓存CSS,JS和媒体,以便通过减少对Web服务器的请求来利用浏览器的缓存。由于配置的目​​标是直接提供缓存的文件,而不必...

    logrotate 日志切割 nginx

    最近用nginx,想按日期生成文件,方便日志清理。nginx以前的版本都是不支持的,后来好像更新了这个问题,但是不想太复杂,不想去研究,就用logrotate配置下,还是挺方便的

    nginx-ingress-controller日志持久化方案的解决

    最近看到一篇公众号讲了nginx-ingress-controller的应用。下面有人评论如何做日志... accesslog:输出到stdout,通过nginx-configuration中的字段可以配置输出到哪个文件。输出到文件后不会自动轮转或清理 errorlog

    解决nginx不支持thinkphp中pathinfo的问题

    其实,要解决nginx不支持pathinfo的问题,有两个解决思路,一是不使用pathinfo模式,二是修改nginx的配置文件,使它支持pathinfo。为了使问题简单化,我选择了第一种方式,因为就第二种方式,我查了很多资料,发现...

    在Linux上安装和配置Nginx作为反向代理服务器

    许多用户在考虑使用Linux时,就想到以前在Windows下常见的程序是否能正常运行,这一点就消除了他们的疑虑。 多用户、多任务 Linux支持多用户,各个用户对于自己的文件设备有自己特殊的权利,保证了

    Nginx和PHP-FPM的启动、重启、停止脚本分享

    服务器上的Nginx和PHP都是源码编译安装的,不像ubuntu一样有自带service启动脚本,所以不支持类似以前的nginx (start|restart|stop|reload)了。自己动手丰衣足食。以下脚本应该在RHEL, Fedora, CentOS下都适用。 一...

    nginx部署多个vue项目的方法示例

    如何连接阿里云服务器就不在这里说了,请看我以前的文章。 首先需要的效果 http://47.97.244.83/login http://47.97.244.83/student/login 文件目录 两个项目并列在同一文件夹内。 准备好两个vue的项目 ...

    Nginx实现异步访问mysql的配置方法

    nginx中有一个模块有这个功能,(以前的文章中扩展,这里叫模块,以后统一叫模块,模块可能准确点,因为扩展是单独的文件,而模块是嵌入到主文件中的),这个模块叫drizzle-nginx-module,下载地址为: ...

    【24】基于Centos7.5源码编译LAMP架构.docx

    会发现我们会使用的架构是Nginx和Apache结合使用:使用Nginx可以做集群等相关配置,可以和Apache一起使用,有的会用Apache去跑php,然后用Nginx做反向代理,比如Apache运行在8080端口,Nginx在80端口,访问php文件时...

    企业资产管理小程序开源版后端+前端.zip

    企业资产管理小程序功能:资产管理,耗材管理,资产盘点,资产履历等。系统全开源版。功能比较强大,目前市场上针对...小程序配置文件 siteinfo.js 域名修改为自己的域名和niacid ID(ID可打开平台小程序网址里查看)

    将PHP从5.3.28升级到5.3.29时Nginx出现502错误

    今天将PHP从5.3.28升级到5.3.29,发现网站打不开了,提示”502 bad gateway”,访问静态资源可以,但访问任何PHP文件都会502。...网上搜索了一下,没人出现我这种问题,所有的编译过程,配置过程,都是照旧,

    3.K8s工作负载原理剖析和实践1

    RC的 YAML 配置文件包括 metadata、spec 和 template 三部分。metadata 定义 RC 的元数据,spec 定义 RC 的规格,template 定义 Pod 的模板。 有状态模式 有状态模式是指应用程序需要保持状态或持久化数据的模式。...

    梦赢开源权限管理系统 v2.0.rar

    5、安全性权限控制采用后台控制与配置文件控制相结合,双重控制更安全;能精确到用户的增删改查操作 Winner权限管理系统(又称:胜利者权限管理系统)是一款基于PHP Mysql开发的web基础系统,系统内置用户管理、...

    梦赢开源权限管理系统 v2.0.zip

    5、安全性权限控制采用后台控制与配置文件控制相结合,双重控制更安全;能精确到用户的增删改查操作   Winner权限管理系统(又称:胜利者权限管理系统)是一款基于PHP Mysql开发的web基础系统,系统内置用户管理...

    basebuntu:用于配置 Ubuntu LTS Web 服务器的 Bash 脚本

    此脚本将在重新安装期间覆盖以前的配置。 虽然我已经包含了一些防止覆盖的检查,但请注意,如果您在一个框上多次运行主选项命令,事情可能会中断。 cd ~; apt-get update; apt-get install git -y; git clone

    Pluto1_9_9_2.rar

    将Interval放到配置文件中,自主设定。头文件定义:long iInterval; 64位程序中调试通过。 V1.9.7 post与get方法的测试 V1.9.8.00 处理转向。当访问指定目录,该目录下没有index.html文件时, 转向到/h/index.html ...

    phpMyAdmin 安装及问题总结

    2/配置文件现在需要绝密的短语密码(blowfish_secret); 3/#2003-服务器没有响应。 由于目前phpMyAdmin的最新版本已经更新到了2.11.5.1,网上流传的很多配置方法都是以前老版本的,已经不太适应新版本的配置要求;...

    graylog-plugin-matomo

    默认情况下,plugin目录是相对于您的graylog-server目录的plugins/文件夹,可以在您的graylog.conf文件中进行配置。 重新启动graylog-server ,您就完成了。 用法 配置Graylog 在Graylog中,转到流的输出配置并...

Global site tag (gtag.js) - Google Analytics