Apache is one of the most powerful and flexible web servers available. Although Apache administrators would disagree, to the uninitiated, Apache can be rather overwhelming to configure. For those who really need Apache but don't want to have to fool with the manual configuration of servers, virtual servers, etc., there is a tool called Webmin that makes this job quite easy.
In my recent Webmin tutorial (DIY: Let Webmin handle all your UNIX administration tasks), I didn't go into the configuration of any of the servers, services, etc. In this post, I show how easy it is to configure your Apache server using the web-based GUI. I will assume that you have Apache and Webmin installed on the same machine and that you have admin access to the server.
What you can configure
Through the Apache configuration files, the numbers of configuration options available are astonishing. If you have the time and the inclination, you can do almost anything with your Apache setup (I hear Apache makes a killer cup of coffee!). Within Webmin, those options are pared down to the following and more:
- Processes and Limits
- Networking and Addresses
- MIME Types
- User and Group
- Per-directory options
- Server HTTP header
- Virtual hosts
Let's dig in to the configuration of Apache. We'll start with solid general options and then make our way to setting up a virtual host -- all with the help of Webmin.
Networking optionsOur first configuration options will deal with listening addresses, ports, and timeouts. To get to these options, point your web browser to the Webmin admin tool, log in, and click the Servers listing (left nav) to reveal the Apache Webserver link. Click the Apache link to reveal the main Apache configuration page (Figure A). Figure A
By default you will land on the Existing Virtual Hosts tab. If no hosts exists, that tab will be blank. (Click the image to enlarge.)Click the Global Configuration tab. As you might expect, the configurations found under this tab affect the entire server. From the Global Configuration tab (Figure B), click the Networking And Addresses icon. Figure B
You can also examine and edit the configuration file through a virtual terminal within Webmin by clicking the Edit Config Files link. (Click the image to enlarge.)In the Networking And Addresses section (Figure C), you can set the specific address and port that Apache listens on. Figure C
After you save the changes, make sure you click the Apply Changes link in the upper right corner. (Click the image to enlarge.)
One Apache configuration that trips people up a lot is the MIME types. This happens quite often when people try to set up a server to serve up dynamic .php files. Instead of serving the files, Apache won't realize those files are to be executed and simply display them. To avoid this, you would need to add a php MIME type, which you can do by following these steps:
- Click the Global Configuration tab and then click the MIME Types link.
- In the new page, scroll all the way down to the bottom and click the Add a New MIME Type button.
- On this new page (Figure D), enter the details for the MIME type and click Save.
If you're unsure of the details for the MIME type, google it so you enter the correct information for the type you want to include. (Click the image to enlarge.)
One of the most powerful Apache features is virtual hosts. To the untrained user, these can be really intimidating, unless you're using Webmin for the setup.
Before you go to Webmin to set up the virtual host, you must create the directory to be used for the virtual host. Where and what this directory is will be entirely up to your setup and your needs, but make sure the webserver has permission to get into the directory. The permissions need to be 0755, so set them with the command chmod -R 0755 /path/to/directory (/path/to/directory is the path to the newly created directory).Now go to the Apache Server page within Webmin and click the Create Virtual Host tab. From this page (Figure E), you can set up the entire virtual host in just a few quick seconds. All you need to configure is:
- Document Root: The path to the new directory.
- Port: If you need this virtual host served up on a non-standard port.
This is the basics; you can fine-tune the virtual host, but the defaults should work out of the box.Figure E
Remember, if you use a non-standard port, that port must be available on your network (if it's being blocked, the new virtual server will not be seen). (Click the image to enlarge.)There's one last configuration to make. Go back to the Existing Virtual Hosts tab and click the link for the virtual host you just created. In this page (Figure F), click the Networking And Addresses link and, if you need, add any alternate virtual server names for your new virtual host. Figure F
Adding alternate virtual server names is optional, though it can make host-based naming much easier. (Click the image to enlarge.)
After you make any changes, click Save and then Click Apply changes. You now should have a working virtual host set up on your Apache server, thanks to the simplicity of Webmin.
Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.