The original post: /r/nginx by /u/elasticsearch_help on 2024-08-02 01:02:56.

What I want to see if possible is to split the config into multiple files as so:

  1. ELK Stack at http://localhost:5601

  2. Rocket.Chat at http://localhost:3000 - Not yet added

Is this possible?

This is my current nginx config on CentOS 7:

server {

listen 80;

listen 443 ssl;

server_name ELK.uhtasi.local;

auth_basic "Restricted Access";

auth_basic_user_file /etc/nginx/htpasswd.users;

ssl_certificate /etc/nginx/ELK.uhtasi.local.crt;

ssl_certificate_key /etc/nginx/ELK.uhtasi.local.key;

ssl_session_cache shared:SSL:1m;

ssl_session_timeout 10m;

ssl_ciphers HIGH:!aNULL:!MD5;

ssl_prefer_server_ciphers on;

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;

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

location /home {

proxy_pass http://localhost:3000;

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;

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

location /app/management {

#auth_basic "Restricted Access";

#auth_basic_user_file /etc/nginx/forbidden.users;

proxy_pass http://localhost:5601;

proxy_read_timeout 90;

limit_except GET {

deny all;

}

# Only allow access to "roman" and "alvin"

if ($remote_user !~* ^(roman|alvin)$) {

return 403; #Forbidden for all other users

}

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

location /app/dev_tools {

proxy_pass http://localhost:5601;

proxy_read_timeout 90;

limit_except GET {

deny all;

}

# Only allow access to "roman" and "alvin"

if ($remote_user !~* ^(roman|alvin)$) {

return 403; #Forbidden for all other users

}

# Add cache control headers

add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";

add_header Pragma "no-cache";

}

}