Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Panel

Table of Contents

NGINX Server for Linux

Note

The following steps require root privilege, be sure that you have the correct access before to continuecontinuing.

...

  • Create a configuration file mftudmg.conf under this directory (normally /etc/nginx/conf.d):. This will create 2 location locations: ‘/' for the UDMG Admin UI and '/service' for the internal authentication mechanism.
Panel

upstream mftudmg_auth_proxy {
# MFT UDMG Auth Proxy Configuration
    server        localhost:5000;
    ip_hash;
    keepalive 10;    
}

server {
    listen        80;

#    listen        443 ssl;
#    ssl_certificate /etc/udmg/certs/udmg.pem;

#    ssl_certificate_key /etc/udmg/certs/udmg.key;
#    ssl_session_timeout 5m;
#    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
     8080ssl_protocols TLSv1.2;
#    ssl_prefer_server_ciphers on;

    server_name   localhost;

    access_log    /var/log/nginx/host.access.log;

    location /service/ {
      proxy_pass  http://mftudmg_auth_proxy/;
    }

    location / {
        try_files $uri $uri/ /index.html;
        root root       /srv/opt/udmg/var/www/mftudmg;
    }
}

  • Remove any /etc/nginx/conf.d/default.conf file, to disable the NGINX default landing page on port 80.
  • Validate that the configuration is correct with the following command:

...

  • Create the Root directory:
Panel

# mkdir -p /srvp /opt/udmg/var/www/mft

...

udmg/

  • Enable and start the NGINX service using the Init system.
Panel

# systemctl enable nginx

# systemctl start nginx

  • Check that the HTTP server was started and is running, for example with the curl command:
Panel

# curl http://localhost:808080
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.21.6</center>
</body>
</html>

This error (403) is exceptedexpected, since we don't have any asset deployed.

...

Create a directory under the configuration folder called "enabled" and add an include directive in the main configuration file inside the http section. For example:

Panel

http {
  include mime.types;
  default_type application/octet-stream;

  include "C:/MFTUDMG/nginx/conf/enabled/*.conf";

  • Create a configuration file mftudmg.conf under this directory (normally C:\UDMG\nginx\conf\enabled):
Panel

upstream mftudmg_auth_proxy {
 # MFT Auth Proxy Configuration
    server        localhost:5000;
}

server {
    listen        80;

#    listen        8080 443 ssl;
#    ssl_certificate /etc/udmg/certs/udmg.pem;

#    ssl_certificate_key /etc/udmg/certs/udmg.key;
#    ssl_session_timeout 5m;
#    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
#    ssl_protocols TLSv1.2;
#    ssl_prefer_server_ciphers on;


    server_name   localhost;

    access_log    logs//mftudmg.access.log;

    location /service/ {
      proxy_pass  http http://mftudmg_auth_proxy/;
    }

    location / {
        try_files $uri $uri/ /index.html;
        root      mft udmg;
    }
}

  • Remove any /etc/nginx/conf.d/default.conf file, to disable the NGINX default landing page on port 80.
  • Validate that the configuration is correct with the following command:

...

  • Create the Root directory under the NGINX main directory called mft udmg:
Panel

C:\UDMG\nginx> mkdir mftudmg

  • Start NGINX
Panel

# start C:\UDMG\nginx> nginx

  • Check that the HTTP server was started and is running, for example with the curl command:
Panel

C:\>curl.exe http://localhost:808080
<html>
<head><title>403 Forbidden</title></head>
<body>
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.23.0</center>
</body>
</html>

This error (403) is exceptedexpected, since we don't have any asset deployed.

...

  • For configuring HTTPS and HTTP redirection, please refer to the web server documentation (Configuring HTTPS servers).
  • The paths in any NGINX configuration file must be specified in UNIX-style, using forward slashes '/'.
  • For running NGINX as a service please refer to the service section in UDMG for Windows Installation