zoukankan      html  css  js  c++  java
  • [Nginx]

    nginx.conf文件内容:

    user  www www;
    worker_processes  2;
    
    error_log  /usr/local/nginx/logs/serror.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 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;
    	log_format '$remote_addr - $remote_user [$time_local] "$request" '
    	              '$status $body_bytes_sent "$http_referer" '
    	              '"$http_user_agent" "$http_x_forwarded_for"';
    	include /usr/local/nginx/conf/vhosts/*.conf;
    }
    

    在vhosts目录下的conf文件内容:

    upstream slave {
    	server xxx.xxx.xxx.xxx max_fails=3 fail_timeout=30s weight=5;
    	server xxx.xxx.xxx.xxx max_fails=3 fail_timeout=30s weight=5;
    }
    
    server {
    	listen	80;
    	server_name  www.XXX.com;
    	
    	#if ($uri ~* "(/login$|/login.html$|/login/index.html$|/admin/.+|/signup$|/signup/.+$|/signup.html$)") {
    	#	return	301	https://$server_name$request_uri;
    	#}
    
    	location / {
    		client_max_body_size 200m;
    		proxy_pass http://slave;
    		proxy_set_header Host $host;
    		proxy_set_header X-Real-IP $remote_addr;
    		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    		client_body_buffer_size 128k;
    		proxy_connect_timeout 600;
    		proxy_read_timeout 600;
    		proxy_send_timeout 600;
    		proxy_buffer_size 64k;
    		proxy_buffers 4 32k;
    		proxy_busy_buffers_size 64k;
    		proxy_temp_file_write_size 64k;
    	}
    
    	location = /50x.html {
    		root   html;
    	}
    }
    
    server{
    	listen 443;
    	ssl on;
    	ssl_certificate /alidata/ssl/server.crt;
    	ssl_certificate_key /alidata/ssl/server.key;
    	server_name  www.XXX.com;
    	
    	#if ($uri !~* "(/login$|/login.html$|/login/index.html$|/static/.+|/common/api/.+|/admin/.+|/signup$|/signup/.+$|/signup.html$)") {
    	#	return	301	http://$server_name$request_uri;
    	#}
    
    	location / {
    		client_max_body_size 200m;
    		proxy_pass http://slave;
    		proxy_set_header Host $host;
    		proxy_set_header X-Real-IP $remote_addr;
    		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    		client_body_buffer_size 128k;
    		proxy_connect_timeout 600;
    		proxy_read_timeout 600;
    		proxy_send_timeout 600;
    		proxy_buffer_size 64k;
    		proxy_buffers 4 32k;
    		proxy_busy_buffers_size 64k;
    		proxy_temp_file_write_size 64k;
    		proxy_set_header X-Forwarded-Proto $scheme;
    		proxy_redirect off;
    	}
    
    	location = /50x.html {
    		root   html;
    	}
    }
    

      

  • 相关阅读:
    生成器函数
    初识函数
    格式化输出
    流程控制-while循环
    流程控制if语句
    Python入门
    Eclipse搭建C++开发环境
    Android SQLite基本用法
    Android拍照后更新相册
    操作系统相册和获取相册路径
  • 原文地址:https://www.cnblogs.com/HD/p/5646299.html
Copyright © 2011-2022 走看看