Build your own LAMP Server under CentOS


Apache2

Install

yum install httpd

Then start it up

service httpd start

Now open the iptables port, this is continuing from our last change but is including two rules, one for SSL connections (https).

iptables -I INPUT 4 -m --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
iptables -I INPUT 5 -m --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
service iptables save

Now you can browse to the installation and see the Apache start-up page. If you do not know what the ip is of your virtual box, type ifconfig at the command line to view the currently assigned address.


PHP5

Install PHP

yum install php

Restart Apache after install

service httpd restart

Now we can check to see if PHP is installed properly, we can run a test page and parse some data. The default directory for Apache’s install is /var/www/html.

nano -w /var/www/html/info.php

Add the following into the new file

Save the file and browse over to the new page. (ie: http://192.168.1.200/info.php)


Posted

in

, ,

by