Feb 25 2015

Apache di ubuntu 12:04

Published by kusuma at 9:23 am under LinuX

Apache 2 Web Server on Ubuntu 12.04 LTS (Precise Pangolin)

Updated Friday, January 10th, 2014 by Linode

This tutorial explains how to install and configure the Apache web server on Ubuntu 12.04 (Precise Pangolin). All configuration will be done through the terminal; make sure you are logged in as root via SSH. If you have not followed the getting started guide, it is recommended that you do so prior to beginning this guide. Also note that if you’re looking to install a full LAMP stack, you may want to consider using our LAMP guides.

Set the Hostname

Before you begin installing and configuring the components described in this guide, please make sure you’ve followed our instructions for setting your hostname. Issue the following commands to make sure it is set properly:

1
2
hostname
hostname -f

The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).

Install Apache 2

Make sure your package repositories and installed programs are up to date by issuing the following commands:

1
2
apt-get update
apt-get upgrade --show-upgraded

Enter the following command to install the Apache 2 web server, its documentation and a collection of utilities.

1
apt-get install apache2 apache2-doc apache2-utils

Edit the main Apache configuration file to adjust the resource use settings. The settings shown below are a good starting point for a Linode 1GB.

/etc/apache2/apache2.conf
1
2
3
4
5
6
7
8
9
10
11
KeepAlive Off

...

<IfModule mpm_prefork_module>
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000
</IfModule>

Install Support for Scripting

The following commands are optional, and should be run if you want to have support within Apache for server-side scripting in PHP, Ruby, Python, or Perl.

To install Ruby support, issue the following command:

1
apt-get install libapache2-mod-ruby

To install Perl support, issue the following command:

1
apt-get install libapache2-mod-perl2

To install Python support, issue the following command:

1
apt-get install libapache2-mod-python

If you need support for MySQL in Python, you will also need to install Python MySQL support:

1
apt-get install python-mysqldb

Your PHP application may require additional dependencies included in Ubuntu. To check for available PHP dependencies run apt-cache search php, which will provide a list of package names and descriptions. To install, issue the following command:

1
apt-get install libapache2-mod-php5 php5 php-pear php5-xcache

Issue the following command to install the php5-suhosin package, which provides additional security to your PHP installation:

1
apt-get install php5-suhosin

If you’re also hoping to run PHP with MySQL, then also install MySQL support:

1
apt-get install php5-mysql
Baca juga artikel yang lain berikut ini:

Trackback URI | Comments RSS

Leave a Reply