How to Configure the Apache Server in Ubuntu

104 17
    • 1). Open the "/etc/apache2/apache2.conf" file in a text editor. Open a command line text editor by typing "sudo nano /etc/apache2/apache2.conf" at a command line, pressing "Enter," then typing your password and pressing "Enter" again. Open a graphical text editor by pressing "ALT+F2," typing "gksu gedit /etc/apache2/apache2.conf," pressing "Enter," then typing your password and pressing "Enter" again.

    • 2). Configure Apache by typing directives into the apache2.conf file or editing the options present by default. Type each directive on a new line in the file.

    • 3). Configure the Apache server's root directory with the "ServerRoot" directive. By default, the line "ServerRoot "/etc/apache2"" is present in the configuration file. Replace "/etc/apache2" with another directory, if desired.

    • 4). Configure the email address of the server's administrator with the "ServerAdmin" directive. Type "ServerAdmin email@server.com" into a new line on the file, replacing "email@server.com" with your email address, then press "Enter."

    • 5). Configure the port of the Apache server with the "Listen" directive. Type "Listen 80" into a new line on the file, replacing "80" with a different port if desired, then press "Enter."

    • 6). Configure the server name of the Apache server with the "ServerName" directive. Type "ServerName server.com" into a new line on the file, replacing "server.com" with the name of your server, then press "Enter."

    • 7). Configure the directory index file with the "DirectoryIndex" directive. Type "DirectoryIndex index.html" into a new line in the file, replacing "index.html" with a different file name if desired. When a user browses to "yourserver.com/," Apache displays "yourserver.com/index.html."

    • 8). Configure the Apache server's error pages with the "ErrorDocument" directive. Type "ErrorDocument 404 /doesnotexist.html" into a new line in the file, replacing "404" with an error code and "/doesnotexist.html" with the path to an error page, then press "Enter." Repeat this step if desired, creating multiple separate lines for different error codes.

    • 9). Save the apache2.conf file. Press "Ctrl+O" in the command line text editor or click "File" in the graphical text editor, then click "Save."

Source...

Leave A Reply

Your email address will not be published.