-
sudo yum update
-
sudo yum install httpd
-
Edit the httpd.conf under /etc/httpd/conf/
cp /etc/httpd/conf/httpd.conf ~/httpd.conf.backup
KeepAlive Off
...
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 80
MaxRequestsPerChild 3000
- Configure Apache Virtual Hosts
Create a file under /etc/httpd/conf.d called vhost.conf. Replace instances of example.com with your own domain information:
/etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/example.com/public_html/
ErrorLog /var/www/example.com/logs/error.log
CustomLog /var/www/example.com/logs/access.log combined
-
sudo service httpd start
sudo /sbin/chkconfig --levels 235 httpd on
Anytime you change an option in your vhost.conf file reload the configuration with the following command: sudo service httpd reload -
Install the MySQL package: sudo yum install mysql-server
-
Start MySQL, and set it to run at boot:
sudo service mysqld start
sudo /sbin/chkconfig --levels 235 mysqld on -
Run mysql_secure_installation to secure MySQL:
mysql_secure_installation ,and set you root user and password -
Install PHP: sudo yum install php php-pear
-
sudo yum install php-mysql
-
Edit /etc/php.ini
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
error_log = /var/log/php/error.log
max_input_time = 30 -
Create the log directory for PHP and give the Apache user ownership:
sudo mkdir /var/log/php
sudo chown apache /var/log/php -
Restart Apache: sudo service httpd restart