Once you got the server or Vps,Login to the server through SSH using the tool called putty.Once you have logged in type in the bellow command.For CENTOS:Installing Apache with Mysql support
#yum install httpd php php-mysql
Set the Apache Service to start automatically when you restart
#chkconfig httpd on #service httpd start
Set the mysql service to start automatically when you restart
#chkconfig mysqld on #service mysqld start
Configuration
If you want to load any other scripts through the ip address,just upload the file to var/www/html.If you want to host a website and load through a website or domain name.follow the bellow steps just edit the httpd.conf file using nano text editor.
#nano /etc/httpd/conf/httpd.conf
- Go to very bottom of the configuration file and add this below lines and replace domain name instead of “www.domainname.com”
NamevirtualHost *:80 <VirtualHost *:80> ServerName domain.com ServerAlias *.domain.com www.domain.com ErrorLog /var/log/htpd/error_log CustomLog /var/www/domain.com DocumentRoot /var/www/domain.com <Directory /var/www/domain.com> ordr allow,deny allow from all <Directory> </VirtualHost>
- Save File
- Restart the apache server by “service httpd restart”
- Test for run
http://domain.com
Apache setup is complete