Serving MDriven with Nginx Server as a Proxy
mNo edit summary
mNo edit summary
Line 17: Line 17:
cd /etc/nginx/sites-available
cd /etc/nginx/sites-available
</syntaxhighlight>The “/etc/nginx/sites-available” directory typically contains configuration files for Nginx virtual hosts. Each file in this directory represents a separate virtual host configuration, allowing you to define settings for different websites or applications hosted on your server. There will be a default config file available already. You can remove it or leave it as is.
</syntaxhighlight>The “/etc/nginx/sites-available” directory typically contains configuration files for Nginx virtual hosts. Each file in this directory represents a separate virtual host configuration, allowing you to define settings for different websites or applications hosted on your server. There will be a default config file available already. You can remove it or leave it as is.


'''Step -2: Create a configuration file for MDriven Server'''<syntaxhighlight>
'''Step -2: Create a configuration file for MDriven Server'''<syntaxhighlight>

Revision as of 17:19, 2 January 2025

This page was created by Stephanie@mdriven.net on 2024-12-20. Last edited by Edgar on 2025-01-20.

After successful installation of MDriven on the Ubuntu Server, this installation also ensured we installed Nginx Web server to create the /var/www/ directory.

Now check the status of nginx service using the command.

service nginx status

The result should be as shown below with Active: active (running) which indicates that Nginx service is up and running.

Documentation Serving MDriven with Nginx Server as a Proxy 1735837499808.png

If Nginx is not running, you can start the service with the command

service nginx start



Step -1: Configure Nginx

Navigate to the nginx directory where we will create a configuration file for MDriven Turnkey and the MDriven Server

cd /etc/nginx/sites-available

The “/etc/nginx/sites-available” directory typically contains configuration files for Nginx virtual hosts. Each file in this directory represents a separate virtual host configuration, allowing you to define settings for different websites or applications hosted on your server. There will be a default config file available already. You can remove it or leave it as is.


Step -2: Create a configuration file for MDriven Server

sudo nano /etc/nginx/sites-available/mdrivenserver

Copy and paste the below content in the file. Replace IP_ADDRESS_OR_DOMAIN_NAME with correct IP address or domain name pointing to your MDriven Server.

server {
    listen 80;
    server_name 10.0.2.15; #---domain-name or IP address

    location / {
        proxy_pass http://127.0.0.1:5042;  # Replace with Mono server's port
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 300;
        proxy_connect_timeout 300;
        proxy_redirect off;
    }

    location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|otf|eot|html|htm)$ {
        root /var/www/html/mdriven;
        expires max;
        log_not_found off;
    }

    error_log /var/log/nginx/mdriven_server_error.log;
    access_log /var/log/nginx/mdriven_server_access.log;
}