Apache Basic Configuration

From Webmin Documentation
Jump to: navigation, search

Apache Webserver is an extremely large and feature-rich piece of software. Approaching it for the first time can be daunting. Luckily, it is extremely easy to install, configure, and maintain as long as you proceed with care and pay attention to the documentation relevant to your installation and environment.

Installation of Apache is may be done from within the module Software Packages, the command line (yum, apt-get) or by clicking on the install-link in the Apache Webserver module page is Apache was not installed yet.

Apache Webserver Install

Install-details are well-documented on the Apache website, and it is also very likely that your OS vendor provides a suitable package to make installation automatic.

What will be covered is the initial hurdle of setting up Apache to serve HTML web pages. The next section will take the configuration one step further to configuring virtual hosting service. Resolution for Virtual Hosts covers the process of configuring name service for your web server with BIND DNS Server.

Configuring Apache Paths

If you've installed Apache Webserver from a package from your OS vendor or if your vendor does not provide a package and it has been installed in the default location selected by the program, you can probably skip this section and proceed to the next section covering initial module selection. For any supported OS, Webmin has a configuration file that includes sensible default paths for the programs that it administers. These configurations assume an installation in the default location for your operating system. So, for example, on a Red Hat Linux system, Webmin will expect to find the httpd.conf file in the /etc/httpd/conf directory, while on Solaris it is expected to be in /usr/local/apache/conf.

Webmin works directly with the Apache configuration files, and so must know where to find them. When you browse to the Apache Webserver module of Webmin for the first time you may be greeted with an error stating that the configuration file could not be found. You'll need to locate the configuration files, as well as the Apache binary, and possibly startup and shutdown scripts for your system, and configure Webmin to search the appropriate locations. The most important paths are probably Apache server root directory and the Path to httpd executable.

Module Selection

Apache is extremely modular, and the vast majority of its available functionality is broken out into small modules that can be loaded at run-time depending on the needs of the specific environment in which it runs. Webmin needs to know about the modules that are available to your Apache so that it can provide configuration options for options that are available and hide options that are not. So, the first time you visit the Webmin Apache Webserver module, you'll be presented a list of Apache modules with check boxes beside them. If you've used a package or a default Apache source installation, you can simply click Configure. If you've built your Apache from scratch with customizations, you'll need to choose the modules that you have made available in your installation, and then click Configure.

Adding Content

Believe it or not, we're now very nearly ready to serve up content with Apache. Once you've reached the primary Apache Webserver module page in Webmin, you'll see a set of icons for the global server options as well as a single virtual server configuration section labeled Default server. The default server is the server that will answer a request when no other virtual servers do. Because we have no virtual servers configured on our system yet, the default server will answer all HTTP requests that reach our machine. Take note of the path in the Document root field, as this is where we'll be placing our first web page.

On my system the Document root for the default server is /var/www/html, which was automatically created during the installation process. So I will create a web page called index.html and drop it into that directory, making sure the page has permissions that will allow the Apache process to read it. The name index.html is significant, and you must use the correct filename for your default page, or else Apache won't serve it without having the file specified after the address in the URL. Other common names for the index page are index.htm and default.htm.

Starting Apache

Now all that is left is to startup your Apache server. Assuming Webmin has been configured correctly for your installation it can even be started from within Webmin with the click of a button. Simply browse to the Apache module main page, and click the Start Apache link in the upper right corner of the page.

To test your new website browse to the IP on which your server resides with your favorite browser. For example, my testing server is located on IP, so I would enter into my browser URL field. Assuming everything went right, you'll see your new web page.

See also