How to create a Web Server Apache MySQL PHP phpMyAdmin on VPS CentOS 6

0
2777

How to create a Web Server (Apache MySQL PHP phpMyAdmin) on CentOS 5. Based on surveys conducted w3techs.com, Apache HTTP Server or commonly called Apache, occupied the first place as the most popular web server applications. The adoption of Apache are at numbers 33.1% (March, 2016) from all over the world. Surely it is not wrong for you users to implement Apache web hosting.

LAMP Centos 6

  1. APACHE INSTALLATION

# yum install httpd

Run the following command to run the Apache service:

# Service httpd start

To make Apache auto-executed (autorun), activate by running this command:

# chkconfig –levels 235 httpd on

Now all configuration of Apache is located at/etc/httpd/conf/httpd.conf. Before making changes to the configuration backup please others first with the command:

# cp /etc/httpd/conf/httpd.conf ~/httpd.conf.backup

All files that have the extensions under stored in/etc/httpd/conf.d/, in that directory will look like an SSL VHOST, configuration, etc. Once again, make sure you do a backup of the data before making changes of files in them. If you need Apache that will be used by a wide range of domains at once, then need additional virtual host configuration file or commonly called by
vhost. To do this bias begins with a web store which is set a variety of user (user). This user needs to be created beforehand with the command:

# useradd user
# passwd userpassword

Note: DocumentRoot can be directed to the desired directory such as/home/user/public_html

Uncheck the comment “#” on the following existing line in the httpd.conf file:

Then edit or create new files with the command:

# vi /etc/httpd/conf.d/vhost.conf

<VirtualHost *:80>

ServerAdmin webmaster@youdomain.com
ServerName youdomain.com
ServerAlias www.youdomian.com

DocumentRoot /home/youdomain.com/public_html/<o:p></o:p>

ErrorLog /home/youdomain.com/logs/error.log<o:p></o:p>

CustomLog /home/youdomain.com/logs/access.log combined<o:p></o:p>

</VirtualHost>

<VitualHost *:80>

ServerAdmin admin@youdomain.org
ServerName youdomain.org
ServerAlias www.youdomain.org
DocumentRoot /home/youdomain.org/public_html/
ErrorLog /home/youdomain.org/logs/error.log
CustomLog /home/youdomain.org/logs/access.log combined
</VirtualHost>

After completed, just run the Apache service.

# service httpd restart

2. MySQL INSTALLATION

Generally while using the cloud server as a web server, users rarely just install Apache as a service, that is the reason why it is called in the name of the package that is LAMP (Linux Apache, MySQL, PHP), or LEMP (Linux, NginX, MySQL, PHP) if the web server application used is EngineX (NginX).

Install MySQL with the command:

# yum install mysql mysql-server

Run MySQL for the first time:

# service mysqld start

After MySQL is active, do the initial configuration with the command below. Unless there is something that needs to be modified, please answer each question according to default dialog or by pressing enter. Afterwards please input a new password when prompted.

# mysql_secure_installation

After performing the initial configuration, proceed with accessing MySQL with:

# mysql -u root -p

Create a database and user that will access it with the command:

mysql> create database namedatabase;
mysql> grant all on namedatabase.* to 'nameuser' identified by 'passworduser';

Run the command quit to end, the database is ready to use for the needs of web servers and server-side scripting.

3. INSTALLING PHPMYADMIN

PhpMyAdmin is an open-source application to access database organized by MySQL. To access it, please do the installation phpMyAdmin by running the command:

# yum install php

Restart Apache to activate the PHP mode in your web server,

# service httpd restart

The way to create a web server using Apache packages in brief-PhpMyAdmin-MySQL in CentOS. May be useful and help improve Your productivity or performance, note that selecting a quality web hosting also has significant operations in your website.

NO COMMENTS

LEAVE A REPLY

This site uses Akismet to reduce spam. Learn how your comment data is processed.