events {}

http {

	##
	# Basic Settings
	##

	limit_conn_zone $binary_remote_addr zone=addr:10m;
	limit_req_zone $binary_remote_addr zone=global_limit:10m rate=10r/s;
	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;

	##
	# SSL Settings
	##

	ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
	ssl_prefer_server_ciphers on;

	##
	# Logging Settings
	##

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

	##
	# Gzip Settings
	##

	gzip on;

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


	#mainnet
	server {
		listen 33340;
		listen [::]:33340;

		# Apply globally to all locations
        limit_req zone=global_limit burst=20 nodelay;
		limit_conn addr 30;

		access_log /var/log/nginx/reverse-access.log;
		error_log /var/log/nginx/reverse-error.log;
        
		
		location /general_info 
		{
			root  /home/mobile_app_config;
			add_header Cache-Control no-cache;
			# set the Expires header to 31 December 2037 23:59:59 GMT, and the Cache-Control max-age to 10 years
			expires 1s;
		}

		location ~ ^/(json_rpc|getheight|gettransactions|sendrawtransaction|force_relay|getinfo|getblocks\.bin|get_o_indexes\.bin|get_o_indexes\.bin|getrandom_outs\.bin|getrandom_outs1\.bin|getrandom_outs2\.bin|getrandom_outs3\.bin|set_maintainers_info\.bin|get_tx_pool\.bin|check_keyimages\.bin|get_pos_details\.bin) {
                    proxy_pass http://127.0.0.1:11211$uri;
		}
  }
}
