Sever setup of apache vhots, php with different versions, varnish, redis, proFTPD, Webmin, OpenVPN on CentOS 7

Install CentOS 7 and login in via putty.

Change Password

Check for new updates

Update your server

Install commonly used programs

Install the EPEL repository

More info on https://support.rackspace.com/how-to/install-epel-and-additional-repositories-on-centos-and-red-hat/

Install Development Tools

Command to list groups

 

Install PHP

Install PHP-FPM and dependancies from base repo

Install PHP FPM 5.6

Include remi repo to get PHP FPM 5.6

install it using RPM command

More info on http://www.servermom.org/how-to-enable-remi-repo-on-centos-7-6-and-5/2790/

After you have compiled run the command to install php fpm 5.6

At this point you have successfully installed ImageMagick package on your system. Now are are going to install ImageMagick php extension, So that we can use it through php code.

If you get this error Message: session_start(): open(/var/lib/php/session/sess_m4qebv1i35l7biibc2hslthk26, O_RDWR) failed: Permission denied (13)

Run the following command

Reload Apache

Restart Apache

Check if Imagick was installed ok

 

Install Apache

Allow Apache Through the Firewall
Allow the default HTTP and HTTPS port, ports 80 and 443, through firewalld:

install Apache devel

start Apache

Edit /etc/httpd/conf/httpd.conf and add the following at end
IncludeOptional sites-enabled/*.conf

Also add index.php in the block

Create folders in apache

Create a dummy vhost for all not configured properties in “/var/www/vhosts/”

99-all.conf

How to create a vhost for new property

Create a new site in “/etc/httpd/sites-available” with name “01-xyz-abc.conf”

Place the virtual host code

Create a file in /etc/php-fpm.d/01-xyz-abc.conf and place this content

Once you have create a vhost config, now you need to enable it

Add new user to to new vhost entry

Change ownership of vhost

Change Permissions of vhost

Now you need to restart apache

Restart the php fpm

install MariaDB

Add the follwing files

Save the file and install MariaDB

You can also check for new updates and see the install guide on https://downloads.mariadb.org/mariadb/repositories

create myslq temp folder in /dev/shm everytime after restarting server.

MySql config file path /etc/my.cnf.d/server.cnf

Change the password and reset the settings after installation

Create new user privilidges

 

Install Redis

Start Redis

To automatically start Redis on boot

Verify that Redis is running with redis-cli

 

Install ProFTPD

Import the EPEL GPG-key:

update the packages

We will install ProFTPD and OpenSSL

We need to start the service and enable it to start at boot automatically.

 

Check ProFTPD version

 

Edit /etc/proftpd.conf file and modify
Search for AuthOrder and replace with:

Create a folder in etc

get user id and group id for below command.

Create ftp users

Restart ProFTPD

Install php 7

Create a file in “/etc/opt/remi/php71/php-fpm.d/01-xyz-abc.conf” and place same code from above /etc/php-fpm.d/01-xyz-abc.conf

Also please make sure to change below line in  “/etc/opt/remi/php71/php-fpm.d/01-xyz-abc.conf”

 

Also change the existing /opt/remi/php56/root/etc/php-fpm.d/www.conf file and change

to

create a folder for sessions

Restart Apache

Restart php fpm

 

Install webmin

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-webmin-on-centos-7

change webmin port

Configure PHP Settings

 

 

Install phpMyAdmin

Copy latest link downoad link from https://www.phpmyadmin.net/downloads/

Correct ownership

 

Follow the guide to install phpmyadmin http://www.trustfm.net/ebooks/DedicatedServer.php?page=MySQL

Reboot the server

Install OpenVPN Access

copy latest link from https://openvpn.net/index.php/access-server/download-openvpn-as-sw/113.html?osfamily=CentOS

bind to all ports on digital ocean otherwise admin wont open

login to admin panel and change its ports if hosting provider is blocking vpn

 

Daily Basic Command

backup command

Rsync command

Rsync to another server.

Example