For a long time now, the Nginx plugin that exists for Webmin did not work after installing it on Ubuntu/Debian. I never got around to figure out how to fix this but today I did. Here’s how to fix the Nginx plugin in Webmin on a Ubuntu server.
Now in all honesty I have no idea what step of all the steps below did the trick of actually getting it to work, but I’m guessing it had something to do with the brackets in the config file. I still need to try this out on a different server without installing the Perl modules first. You’re free to experiment yourself if you dare. If so, let me know what the specific fix was.
First of course you need to install the Nginx module for Webmin. It’s a third party module so add it using the correct option on the screen you see here.
Search for Nginx, select it and install it. Once it is installed you will find the tab on the left under Servers. If not, refresh your modules first. Chances are very likely that you will see a page with some errors that are Perl related. If this is the case continue to follow these steps.
In webmin open the Others tab, and then Perl Modules. Choose “From CPAN, named” and search for DBD::mysql and installit. Do the same thing for all of the following:
HTML::Entities
DBI
GD
DBD::mysql
If you run into any problems you can alternatively install the plugin through the command line. To start first use this command:
perl -MCPAN -e shell
Now you can install any plugin by entering:
i HTML::Entities
When it’s installed optionally do a “reload cpan” or install more plugins. Use te “quit” command to exit the perl inputline. If you’re running the earlier mentioned command for the first time you might also want to start of with “install CPAN” and “reload CPAN”
Next step may seem difficult but it really isn’t. We need to add some \ to a config file. So edit the following file and make the changes I placed below.
nano /usr/share/webmin/nginx/nginx-lib.pl
Go to line 199 and add a backslash before the opening bracket.
if ($if ($line =~ /server \{$/) {
Do not forget to add a backslash before the closing bracket on line 202.
if ($line =~ /\}$/) {
Save the file and now it should work after refreshing the Webmin Nginx page.