Important
This article is obsolete and may contain outdated information. Please refer to the How to install Webmin on Linux for updated information.
Webmin is a free, open-source and web-based system configuration tool for Linux-based operating systems. It is very useful for users who don’t know the Linux command line. You can create and manage user accounts, Apache, DNS, share files, disk quotas, service configuration and many more through the web browser. Webmin also allows you to manage domains, mailboxes and aliases from the central location.
In this tutorial, you’ll learn how to install Webmin and configure it with Nginx as a reverse proxy on Ubuntu 18.04 server.
Requirements
- A server running on Ubuntu 18.04.
- A static IP address set up on your server.
- A root password set up on your server.
Getting Started
First, you will need to update your system with the latest version. You can update it with the following command:
# apt-get update -y
# apt-get upgrade -y
Once your server is updated, restart it to apply all the configuration changes.
Next, install some required dependencies to your system:
# apt-get install software-properties-common apt-transport-https wget -y
Install Webmin
By default, Webmin is not available in the Ubuntu 18.04 default repository. So you will need to add the Webmin repository to your system.
First, import the Webmin GPG key by running the following command:
# wget -q http://www.webmin.com/jcameron-key.asc -O- | apt-key add -
Next, add the Webmin repository with the following command:
# add-apt-repository "deb [arch=amd64] http://download.webmin.com/download/repository sarge contrib"
Once the repository has been added, update your repository and install Webmin with the following command:
# apt-get install webmin
Once Webmin has been installed successfully, you should get the following output:
Processing triggers for systemd (237-3ubuntu10) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up libpython2.7-stdlib:amd64 (2.7.15-4ubuntu4~18.04.1) ...
Setting up perl-openssl-defaults:amd64 (3build1) ...
Setting up python2.7 (2.7.15-4ubuntu4~18.04.1) ...
Setting up libpython-stdlib:amd64 (2.7.15~rc1-1) ...
Setting up python (2.7.15~rc1-1) ...
Setting up libnet-ssleay-perl (1.84-1ubuntu0.2) ...
Setting up webmin (1.930) ...
Webmin install complete. You can now login to https://ubuntu1804:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Processing triggers for systemd (237-3ubuntu10) ...
Next, check the status of Webmin with the following command:
# systemctl status webmin
You should see the following output:
● webmin.service - LSB: web-based administration interface for Unix systems
Loaded: loaded (/etc/init.d/webmin; generated)
Active: active (running) since Thu 2019-10-03 10:14:04 UTC; 6min ago
Docs: man:systemd-sysv-generator(8)
Tasks: 1 (limit: 1114)
CGroup: /system.slice/webmin.service
└─16074 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
Oct 03 10:14:00 ubuntu1804 systemd[1]: Starting LSB: web-based administration interface for Unix systems...
Oct 03 10:14:01 ubuntu1804 perl[16059]: pam_unix(webmin:auth): authentication failure; logname= uid=0 euid=0 tty= ruser= rhost= user=root
Oct 03 10:14:03 ubuntu1804 webmin[16059]: Webmin starting
Access Webmin
Webmin is now installed and running on port 10000. You can access it by visiting the URL https://your-server-ip:10000. You will be redirected to the following page:
Provide your root username, password and click on the Sign in button. You should see the Webmin dashboard in the following screen:
Configure Nginx as a Reverse Proxy for Webmin
By default Webmin is listening on port 10000. So you will need to configure Nginx as a reverse proxy to forward a request on port 80 to 10000.
To do so, first install Nginx with the following command:
# apt-get install nginx -y
Once installed, create a new Nginx virtual host file for Webmin:
# nano /etc/nginx/sites-available/webmin.conf
Add the following lines:
upstream webmin {
server 127.0.0.1:10000 weight=100 max_fails=5 fail_timeout=5;
}
server {
listen 80;
server_name 192.168.0.101;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://webmin/;
}
}
Save and close the file. Then, check Nginx for any syntax error with the following command:
# nginx -t
You should get the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Next, enable the Nginx virtual host and restart Nginx service with the following command:
# ln -s /etc/nginx/sites-available/webmin.conf /etc/nginx/sites-enabled/
# systemctl restart nginx
Congratulations! You can now access your Webmin web interface without specifying the port 10000.