Installing cloudflare certificate on origin server

There can be more that one scenario on how you are hosting your web application. They are: Scenario 1: You serve your website directly through apache web server without using any proxy server. Scenario 2: You serve your website through an NGINX based front-proxy server and on the back-end the application is running on apache … Continue reading Installing cloudflare certificate on origin server

Advertisement

Using NGINX as load balancer and scaling apache using docker-compose

Overview: The main approach here is to use NGINX as a load balancer to distribute load between multiple instance of apache server propped up using docker-compose. Here the NGINX will be handing all the traffic through port 80 and distributing it throughout the different available replicas of the apache server. Our approach is to serve … Continue reading Using NGINX as load balancer and scaling apache using docker-compose

Paginating custom collections in laravel

In order to be able to paginate custom collections created in laravel using the collection() method add the following code in the AppServiceProvider.php if (!\Illuminate\Support\Collection::hasMacro('paginate')) { \Illuminate\Support\Collection::macro('paginate', function ($perPage = 15, $page = null, $options = []) { $page = $page ?: (Paginator::resolveCurrentPage() ?: 1); return (new \Illuminate\Pagination\LengthAwarePaginator( $this->forPage($page, $perPage)->values()->all(), $this->count(), $perPage, $page, $options)) ->withPath(''); … Continue reading Paginating custom collections in laravel

Running multiple websites on a VPS using docker and NGINX reverse proxy

It is possible to run multiple websites running on difference instances of docker using different ports. The NGINX server will listen on port 80 and forward to appropriate docker instance and port based on the domain name. One approach of getting to this is to install NGINX server and manually configure this to forward to … Continue reading Running multiple websites on a VPS using docker and NGINX reverse proxy

Linux: Switching PHP version in Apache

Make sure the repository link is added to the source list before trying to install. Now install the PHP version you want to install. Install the common extensions For apache install the module. After module of PHP is installed disable the existing version in apache and enable the targeted version. To set default CLI php … Continue reading Linux: Switching PHP version in Apache

2020: Making CodeIgniter Modular

This is an implementation that I did recently using CodeIgniter framework for a project. It uses the default implementation of CodeIgniter and adds modularity. Out of the box CodeIgniter framework has `application` and `system` folder at the root. We will use multiple copies of the `application` folder as separate modules which will share the same … Continue reading 2020: Making CodeIgniter Modular