This is how I set up a WordPress hosting for my clients. And believe me, I have got a page load time of less than one second, and when set up in a $10 digital ocean server, it could handle ~200 concurrent users.
The first step to set up a server for WordPress Hosting would be to spin up a Server from Digital Ocean or Vultr or Linode and prepare. Once you have completed the steps, you can proceed to configure the website to use Cloudflare.
Update server and disable SELinux
yum clean all yum -y update yum -y install wget lsof mailx nano rsync perl sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config reboot
Install IUS repository
yum -y install gcc yum -y install epel-release For Cent OS-6 rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-11.ius.el6.noarch.rpm For CentOS-7 rpm -Uvh http://dl.iuscommunity.org/pub/ius/stable/Redhat/7/x86_64/ius-release-1.0-11.ius.el6.noarch.rpm
sed -i '/dev\/shm/ s/defaults/defaults,nosuid,noexec/' /etc/fstab
Install Nginx
mkdir /root/configs cd /root/configs wget files.acpaneltech.com/nginx.repo mv nginx.repo /etc/yum.repos.d/
yum -y install nginx chkconfig nginx on rm -f /etc/nginx/conf.d/default.conf touch /etc/nginx/conf.d/default.conf; chattr +i /etc/nginx/conf.d/default.conf
Install PHP-FPM
PHP 5.6
yum -y install php56u-bcmath php56u-cli php56u-common php56u-fpm php56u-gd php56u-imap php56u-intl php56u-mbstring php56u-mcrypt php56u-mysqlnd php56u-pdo php56u-pear php56u-pecl-memcache php56u-soap php56u-xml php56u-xmlrpc php56u-devel php56u-opcache
PHP 7
yum install php70u-opcache php70u-mbstring php70u-xmlrpc php70u-pear php70u-pecl php70u-gd php70u-soap php70u-fpm php70u-pecl php70u-cli php70u-xml php70u-common php70u-devel php70u-mcrypt php70u-intl php70u-pdo php70u-mysqlnd php70u-imap php70u-bcmath php70u-process php70u-json
PHP 7.2
yum install php72u-opcache php72u-mbstring php72u-xmlrpc php72u-pear php72u-pecl php72u-gd php72u-soap php72u-fpm php72u-pecl php72u-cli php72u-xml php72u-common php72u-devel php72u-mcrypt php72u-intl php72u-pdo php72u-mysqlnd php72u-imap php72u-bcmath php72u-process php72u-json
Install MariaDB
cd /root/configs wget files.acpaneltech.com/MariaDB.repo mv MariaDB.repo /etc/yum.repos.d/ yum install MariaDB-server MariaDB-client
Enable Varnish, Nginx, MariaDB, and PHP-fpm at boot.
for i in php-fpm nginx mysql ; do chkconfig $i on ; done
Now that we have installed most of the necessary Applications to set up the server for WordPress Hosting, we now need to proceed to configure them. Replace WEBSITE_NAME below with the website name that you’re going to create.
mkdir -p /home/websites/nginx mkdir -p /home/websites/content/WEBSITE_NAME/public_html adduser websites chsh -s /sbin/nologin websites
Download configuration files from the repository
cd /root/configs wget http://files.acpaneltech.com/nginx.conf wget http://files.acpaneltech.com/www.conf wget http://files.acpaneltech.com/website.tld.conf mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old mv nginx.conf /etc/nginx/nginx.conf mv /etc/php-fpm.d/www.conf /etc/php-fpm.d/www.conf.old mv www.conf /etc/php-fpm.d/www.conf mv website.tld.conf /home/websites/nginx/WEBSITE_NAME.conf chown -R websites:websites /home/websites/content
At this point, you will need to edit the file /home/websites/nginx/WEBSITE_NAME.conf and replace the occurrences of website.tld to your website URL. ( in lines 5, 14 )
Start Services
service nginx start service php-fpm start service mysql start mysql_secure_installation
Set up the MySQL root password. With this, your server is ready to host the WP server.
Download and install WordPress.
cd /home/websites/content/WEBSITE_NAME/ wget wordpress.org/latest.zip unzip latest.zip rsync -av wordpress/ public_html/ rm -rf latest.tar.gz wordpress
Create MySQL Database
mysqladmin create mysite_db
Login to MySQL console and run this.
GRANT ALL ON mysite_db.* to 'mysite_user'@'localhost' identified by 'strongpass'; flush privileges;
With this, you should be able to load the site if the DNS resolution is complete and then install and configure WordPress.
Leave a Reply