Header Ads

Install Apache + PHP on Ubuntu 14.04















To start we will have the following machine to serve as web client for loadbalancer server.
One - Loadbalancer Server (NGINX)
Two - Web Application Server

Append Host files or if you have DNS Server add the A Record;
@everyhost:~#vi /etc/hosts
192.168.10.39 app2   # nginx loadbalancer
192.168.10.37 app2   # web app 1
192.168.10.38 app2   # web app 2

On Web 1 & Web 2 web application server install ubuntu apache2 & PHP
@web1:~#apt-get install apache2

Testing Apache2
Open your web browser and navigate to http://localhost/ or http://server-ip-address/.


Install PHP

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:
@web1:~#apt-get install php5 php5-mysql libapache2-mod-php5

Test PHP

Create a sample “testphp.php” file in Apache document root folder.
@web1:~#vi /var/www/html/testphp.php

Add the following lines.
[code]phpinfo();[/code] code not appear

 Restart apache2 service:
@web1:~#service apache2 restart

Navigate to http://server-ip-address/testphp.php. It will display all the details about php such as version, build date and commands etc.

If you want to install all php modules, enter the command sudo apt-get install php* and restart the apache2 service. To verify the modules, open web browser and navigate to http://server-ip-address/testphp.php. You will able to see all installed php modules.

Now edit the index.html or create a new default page, This step is needed to differentiate the loadbalance order for each web application server;
@web1:~#vi /var/www/html.index.html

find

append this below the above textand webserver 2 accordingly

  It works! on Webserver 1


Save the file and test connection to each, result as expected.
// Repeat the above step on the Web2 Server
// d0ne

No comments

Gobokster. Powered by Blogger.