Configuring Nginx.

Issues related to applications and software problems
hack3rcon
Posts: 380
Joined: 2014/11/24 11:04:37

Configuring Nginx.

Post by hack3rcon » 2019/01/14 10:16:53

Hello.
Where is the location of Nginx configuration file?

Code: Select all

# nano /etc/nginx/nginx.conf
Or :

Code: Select all

/etc/nginx/sites-enabled/default
If I want to add some security configurations like below then which file must be used?

Code: Select all

add_header X-XSS-Protection "1; mode=block";

----------
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
         return 444;
     }

----------
server {
listen       443 ssl;
   server_name "Your Website Name";
   ssl                 on;
   ssl_certificate     /Location/1.pem;
   ssl_certificate_key /Location/1.key;
   }
Thank you.

mghe
Posts: 745
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: Configuring Nginx.

Post by mghe » 2019/01/14 13:47:16

hack3rcon wrote:
2019/01/14 10:16:53
Hello.
Where is the location of Nginx configuration file?

Code: Select all

# nano /etc/nginx/nginx.conf
Or :

Code: Select all

/etc/nginx/sites-enabled/default
If I want to add some security configurations like below then which file must be used?

Code: Select all

add_header X-XSS-Protection "1; mode=block";

----------
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
         return 444;
     }

----------
server {
listen       443 ssl;
   server_name "Your Website Name";
   ssl                 on;
   ssl_certificate     /Location/1.pem;
   ssl_certificate_key /Location/1.key;
   }
Thank you.

Configure file should in /etc/nginx/ and /etc/nginx/conf.d/ to keep some order in the configure files.
Does schema '/etc/nginx/sites-enabled/default' comes from Debian faimily OS.

Security configurations described by You, should be add in server section.

hack3rcon
Posts: 380
Joined: 2014/11/24 11:04:37

Re: Configuring Nginx.

Post by hack3rcon » 2019/01/15 06:38:29

mghe wrote:
2019/01/14 13:47:16
hack3rcon wrote:
2019/01/14 10:16:53
Hello.
Where is the location of Nginx configuration file?

Code: Select all

# nano /etc/nginx/nginx.conf
Or :

Code: Select all

/etc/nginx/sites-enabled/default
If I want to add some security configurations like below then which file must be used?

Code: Select all

add_header X-XSS-Protection "1; mode=block";

----------
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
         return 444;
     }

----------
server {
listen       443 ssl;
   server_name "Your Website Name";
   ssl                 on;
   ssl_certificate     /Location/1.pem;
   ssl_certificate_key /Location/1.key;
   }
Thank you.

Configure file should in /etc/nginx/ and /etc/nginx/conf.d/ to keep some order in the configure files.
Does schema '/etc/nginx/sites-enabled/default' comes from Debian faimily OS.

Security configurations described by You, should be add in server section.
Thank you but server section in which file?

mghe
Posts: 745
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: Configuring Nginx.

Post by mghe » 2019/01/15 08:08:48

In: /etc/nginx/nginx.conf or You can make separate file.

Ream some doc in nginx website, there are a lot information.

hack3rcon
Posts: 380
Joined: 2014/11/24 11:04:37

Re: Configuring Nginx.

Post by hack3rcon » 2019/01/15 09:26:44

mghe wrote:
2019/01/15 08:08:48
In: /etc/nginx/nginx.conf or You can make separate file.

Ream some doc in nginx website, there are a lot information.
Thank you. It has not any "server" section. Must I create it myself?
If I adding my lines to "/etc/nginx/sites-enabled/default" then?

hack3rcon
Posts: 380
Joined: 2014/11/24 11:04:37

Re: Configuring Nginx.

Post by hack3rcon » 2019/01/17 19:31:21

Any idea?

mghe
Posts: 745
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: Configuring Nginx.

Post by mghe » 2019/01/17 19:59:26

hack3rcon wrote:
2019/01/15 09:26:44

Thank you. It has not any "server" section. Must I create it myself?
How did You check it?

hack3rcon
Posts: 380
Joined: 2014/11/24 11:04:37

Re: Configuring Nginx.

Post by hack3rcon » 2019/01/18 11:35:57

mghe wrote:
2019/01/17 19:59:26
hack3rcon wrote:
2019/01/15 09:26:44

Thank you. It has not any "server" section. Must I create it myself?
How did You check it?
I did:

Code: Select all

$ cat /etc/nginx/nginx.conf 
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
	worker_connections 768;
	multi_accept on;
	use epoll;

}

http {

	##
	# Basic Settings
	##

	sendfile on;
	tcp_nopush on;
	tcp_nodelay on;
	keepalive_timeout 55;
	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_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 /etc/nginx/sites-enabled/*;

}



#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;
#	}
#}

mghe
Posts: 745
Joined: 2015/11/24 12:04:43
Location: Katowice, Poland

Re: Configuring Nginx.

Post by mghe » 2019/01/20 08:00:01

How did You install nginx?
From where did You copy nginx.conf config file ?

hack3rcon
Posts: 380
Joined: 2014/11/24 11:04:37

Re: Configuring Nginx.

Post by hack3rcon » 2019/01/21 07:08:31

mghe wrote:
2019/01/20 08:00:01
How did You install nginx?
From where did You copy nginx.conf config file ?
I used "yum".

Post Reply