Setup web server on Amazon AMI or CentOS [Part-1]
If you are using Amazon aws with ec2 instances, then i assume you already have the pem file to connect to the instances. Normally you will have different instances for your projects.
I normally setup either Amazon AMI or Cent OS, prefer Amazon AMI as it is also based on Cent OS. Cent OS is best and easy OS for servers. I love the configuration and level of interaction it provides.
Let’s say you want to install a web server with MySQL and PHP, run the following command:
sudo yum install httpd mysql-server php php-mysql mysql php-xml php-pdo php-odbc php-soap php-common php-cli php-mbstring php-bcmath php-ldap php-imap php-gd mod_ssl
That will install all the necessary modules and packages to run a fully functional server.
In some cases we don’t need/want a web server, just database server will do:
sudo yum install mysql-server mysql
That will only install database server on the instance.
Now let’s say we dont need either PHP or MySQL:
sudo yum install httpd
Some time we don’t need database server on the same web server instances:
sudo yum install httpd php php-xml php-mysql php-pdo php-odbc php-soap php-common php-cli php-mbstring php-bcmath php-ldap php-imap php-gd mod_ssl
That will install all necessary packages excluding MySQL.
Now if you have a MySQL server, for sure you would like to make it secure, that is easy:
The above command will ask you some questions, answer the questions carefully and you will get through it.
Don’t forget to remove anon users and test database while running the above command.
If you have .htaccess file and want to utilize mod rewrite, enable it in /etc/httpd/conf/httpd.conf in the server directory section:
AllowOverride None to
To auto restart the services:
sudo chkconfig httpd on sudo chkconfig mysqld on
sudo systemctl enable httpd sudo systemctl enable mysqld
Manually start the services:
sudo service httpd start sudo service mysqld start
sudo systemctl start httpd sudo systemctl start mysqld
Part-1: Setup web server on Amazon AMI or CentOS
Part-2: Backup MySQL data into CSV
Part-3: Backup MySQL data into CSV with PHP
Part-4: Backup and Restore MySQL databases
Part-5: Speed up your website loading time by using PHP APC