Nginx

Install Nginx

Nginx is considered overall more secure and faster for static contents than Apache. Nginx takes up less storage space and consumes less memory. NGINX often performs better than Apache with many connections on small VPS. Due to its lower resource consumption. You can save money using Nginx IMHO.

1. Install Nginx

Install the NGINX Open Source package:

sudo apt-get install nginx.

Verify the installation:

sudo nginx -v nginx version

Update Debian

sudo apt update && sudo apt upgrade
2. Config the default file

Add the "default" file using Webmin File Manager:

Default file

Let Nginx know these settings by creating a "symlink".

ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default

Add your configuration to "default" file

Edit default

The configuration in "default" file for all websites could look like this

server {
    server_name go4webdev.org www.go4webdev.org;
                      
    location / {
        proxy_pass http: //localhost:9090;
    }
}
                      
server {
    server_name static.go4webdev.org;
                      
    location / {
        proxy_pass http: //localhost:9091;
    }
}
                      
server {
    server_name table.go4webdev.org;
                      
    location / {
        proxy_pass http: //localhost:9092;
    }
}
                      
        
etc...
        
2. Restart Nginx

You also have to restart the Nginx server to apply the changes. Enter the following command in Webmin terminal to restart the Nginx server. Note that your Go executable may be uploaded first.

Restart Nginx
sudo service nginx restart