ADVERTISEMENTS

Best way to Configure Apache Server on an Ubuntu

Himanshu BatraJun 20, 2019
Best way to Configure Apache Server on an Ubuntu

Apache is most powerful server which is already serving more than half of all active websites. Features of apache server includes support of multiple programming languages, authentication mechanism and server-side scripting. You can be enhanced it's features by adding several kind of extensions.Most of the web hosting companies are also using this server for providing shared hosting & server supports.

ADVERTISEMENTS

Installation

You can easily install apache by executing the following commands:

sudo apt-get update
sudo apt-get install apache2

This is the only necessary things for setup of apache server in your ubuntu machine. After installation, you can test your server is working or not by your IP address e.g. 127.0.0.1 in a web browser. Server is running but no content has been added and you will get the default index page.

Default Apache Index Page

File Hierarchy

On Ubuntu, apache stores its configuration files at path i.e. /etc/apache2. Here, you'll find several number of plain text files and folders in this directory.

  • apache2.conf: Main configuration file of the server. It comes with default configration detail with central point of access.
  • ports.conf: For specifing the ports that virtual hosts should listen. In case of SSL, this file must be correct.
  • conf.d/: For controlling specific aspects of the Apache and used to default security choices.
  • sites-available/: Contains all of the virtual host files which will establish which content gets served for which requests.
  • sites-enabled/: Establishes which virtual host definitions will be used.

These are the major files and directories which you will get after installation of apache web server.

ADVERTISEMENTS

Enable Modules

You can easily expend apache web server by installing modules which can be enabled or disabled by using the "a2enmod" and "a2dismod" commands respectively. They work in the same way as the "site" versions of these commands.

a2enmod [ [-q|--quiet] module]
a2dismod [ [-q|--quiet] module] 

After enabling or disabling module, you'll have to reload your configuration changes.

ADVERTISEMENTS