nginx.conf配置

Posted S大好人S

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx.conf配置相关的知识,希望对你有一定的参考价值。

user www-data;
worker_processes 8;
pid /var/run/nginx.pid;

worker_rlimit_nofile 262144;

events {
	worker_connections 40000;
	# multi_accept on;
}

http {
	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 65;
	types_hash_max_size 2048;
	# server_tokens off;

	server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;
	error_log /var/log/nginx/error.log;

	##
	# Gzip Settings
	##

	gzip on;
	gzip_disable "msie6";

	gzip_vary on;
	gzip_proxied any;
	gzip_comp_level 6;
	gzip_buffers 16 8k;
	gzip_http_version 1.1;
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

	##
	# nginx-naxsi config
	##
	# Uncomment it if you installed nginx-naxsi
	##

	#include /etc/nginx/naxsi_core.rules;

	##
	# nginx-passenger config
	##
	# Uncomment it if you installed nginx-passenger
	##
	
	#passenger_root /usr;
	#passenger_ruby /usr/bin/ruby;

	##
	# Virtual Host Configs
	##

	fastcgi_temp_path /tmp/ngx_fcgi_tmp;
	fastcgi_cache_path /tmp/ngx_fcgi_cache levels=2:2 keys_zone=fcgi:128m inactive=1d max_size=256m;
        fastcgi_cache_key "$scheme$request_method$host$request_uri";

	upstream backend
        {
           server xxx.xxx.xxx.xxx;
        }

	upstream db 
	{
	   server xxx.xxx.xxx.xxx;
	}

	upstream dota2
	{
	   server xxx.xxx.xxx.xxx; #DOTA
	}

	upstream users
	{
	   server xxx.xxx.xxx.xxx;
	}

	upstream lushi {

	   server xxx.xxx.xxx.xxx; #User
	}

	upstream dota2ob
	{
	   server xxx.xxx.xxx.xxx; #User
	}

	upstream lol
	{
	   server server xxx.xxx.xxx.xxx;#lol1
	}
	upstream gousu
        {
	   server server xxx.xxx.xxx.xxx;
	}

	include /etc/nginx/conf.d/*.conf;
	include /etc/nginx/sites-enabled/*;
}

  

以上是关于nginx.conf配置的主要内容,如果未能解决你的问题,请参考以下文章

Nginx的配置

如何用nginx.conf配置nginx

linux nginx配置多个网站

nginx配置文件nginx.conf详解

Nginx配置转发

nginx location静态文件配置