# check the config for syntax errors
sudo nginx -t

# reload nginx
sudo service nginx reload

NGINX config

server {
    # size of upload files
    client_max_body_size 32m;

    # 301 redirect
    return 301$request_uri;
    return 301 https://$host$request_uri;

NGINX SSL + auth_basic

Add user/password for base auth:

sudo -v
echo "user:`openssl passwd -apr1`" | sudo tee -a /etc/nginx/htpasswd.users

Change the Nginx default server block /etc/nginx/sites-available/default:

server {
        listen 80 default_server;
        return 301 https://$host$request_uri;

server {
        listen 443 ssl default_server;

        # Replace with your hostname

        ssl on;

        # Certs have to exist
        ssl_certificate /path/to/keys/cert.crt;
        ssl_certificate_key /path/to/keys/key.key;

        auth_basic "Restricted Access";
        auth_basic_user_file /etc/nginx/htpasswd.users;

        location / {
                proxy_pass http://localhost:5601;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection 'upgrade';
                proxy_set_header Host $host;
                proxy_cache_bypass $http_upgrade;


NGINX log off

Off images access loging in access_log:

location ~* \.(gif|jpg|png) {
        access_log off;

Change images access logimg location:

location ~* \.(gif|jpg|png)$ {
        access_log /path/to/access.log;

Off access loging to dir and subdir:

location ^~ /images/ {
        access_log off;