# inception modifications :
#
# ssl_protocols :
#   < ssl_protocols TLSv1.3; # Dropping SSLv3, ref: POODLE
#   > ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
# gzip :
#   < gzip off;
#   > gzip on;
# sites-enabled :
#   < # include /etc/nginx/sites-enabled/*;
#   > include /etc/nginx/sites-enabled/*;
																			# doc : https://nginx.org/en/docs/dirindex.html

user www-data;																# process owner name, can be anything
worker_processes auto;														# a worker is a process that handles incoming requests, auto to automatically adjust the number of processes available
pid /run/nginx.pid;															# defines a file that will store the process id of the main process
include /etc/nginx/modules-enabled/*.conf;									# include a file

events {																	# section for connection processing directives
	worker_connections 768;													# max number of connection that can be opened by a worker process
	# multi_accept on;
}

http {																		# section for http server directives
	##
	# Basic Settings
	##

	sendfile on;															# enable the use of linux sendfil() function, that transfer data directly betzeen fd, so withour copying to intermediate memory buffer, it increases performances in most cases (https://stackoverflow.com/questions/58066785/always-use-sendfile-with-nginx-on-linux)
	tcp_nopush on;															# enables the socket option TCP_CORK/TCP_NOPUSH, that allows to send packets filled with more datas (https://baus.net/on-tcp_cork/)
	tcp_nodelay on;															# opposit of TCP_CORK, TCP_NODELAY says the application to send datas as soon as it receives it, both options are exclusives but can work together in modern kernel (https://stackoverflow.com/questions/3761276/when-should-i-use-tcp-nodelay-and-when-tcp-cork)
	keepalive_timeout 65;													# in seconds, defines time before closing a connexion without activity
	types_hash_max_size 2048;												# maximum size for the list that stores duplicates of the hash table, size of the hash table is chosen accordingly (https://nginx.org/en/docs/hash.html, hash table : https://www.youtube.com/watch?v=KyUTuwz_b7Q)
	# server_tokens off;

	# server_names_hash_bucket_size 64;
	# server_name_in_redirect off;

	include /etc/nginx/mime.types;											# include a file
	default_type application/octet-stream;									# defines the default MIME type (default is text/plain)

	##
	# SSL Settings
	##

	ssl_protocols TLSv1.3; # Dropping SSLv3, ref: POODLE					# enables the specified protocols. The TLSv1.1 and TLSv1.2 parameters works only when OpenSSL 1.0.1 or higher is used, and the TLSv1.3 only when OpenSSL 1.1.1 or higher is used
	ssl_prefer_server_ciphers on;											# Specifies that server ciphers should be preferred over client ciphers when using the SSLv3 and TLS protocols (a cipher is "an algorithm for performing encryption or decryption, a series of [...] steps that can be followed as a procedure" https://en.wikipedia.org/wiki/Cipher_suite)

	##
	# Logging Settings
	##

	access_log /var/log/nginx/access.log;									# defines where to write the access logs. if gzip is used, the log will be buffered
	error_log /var/log/nginx/error.log;										# defines where to write the error logs. if gzip is used, the log will be buffered

	##
	# Gzip Settings
	##

	gzip off;																# enable gzipping of responses. gzip is an algorithm that compress the data (disabled for security reasons : https://bugs.debian.org/773332)

	# 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/javascript text/xml application/xml application/xml+rss text/javascript;

	##
	# Virtual Host Configs
	##

	include /etc/nginx/conf.d/*.conf;										# include the *.conf files found in conf.d folder. do the same as "sites-enabled" with another approach : you put your .conf files for the site inside this folder, and if you want to disable a config file you just rename it to no have a .conf suffix
	# include /etc/nginx/sites-enabled/*;									# include all the (symlink) files found in sites-enabled folder. do the same as "conf.d" with another approach : you put all your configurations files into a "/etc/nginx/sites-available/" folder, and you put symlinks of a selection of thoses files that you want to use for the site, into "/etc/nginx/sites-enabled/" folder (bad practice : https://serverfault.com/questions/527630/difference-in-sites-available-vs-sites-enabled-vs-conf-d-directories-nginx#answer-870709)
}


#mail {
#	# See sample authentication script at:
#	# http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#	# auth_http localhost/auth.php;
#	# pop3_capabilities "TOP" "USER";
#	# imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#	server {
#		listen     localhost:110;
#		protocol   pop3;
#		proxy      on;
#	}
# 
#	server {
#		listen     localhost:143;
#		protocol   imap;
#		proxy      on;
#	}
#}

