7 Tips for Adding a Second Server to your App

Adding a second server to your app can be a great way to improve your app’s performance and/or increase its reliability. However, there are a couple of things you need to keep in mind when adding a second server.

In this article, we’ll discuss the key things you need to consider when adding an additional server to your app. We’ll use a Laravel hosted in Laravel Forge as the example here, but the concepts can be applied to any kind of application, not even limited to the PHP language.

Credit : https://laravel-news.com/adding-a-second-server-to-your-apphttps://laravel-news.com/adding-a-second-server-to-your-app

Enable HTTPS on laravel App using apache2 Ubuntu

This reply was automagically generated by our local A.I. Think of it as a one-off attempt to instantly solve your problem. It will not respond to further replies.

The issue is that the SSL certificate being used is not trusted on other devices. To fix this, a trusted SSL certificate needs to be obtained and installed on the server. One option is to use a free SSL certificate from Let’s Encrypt.

To install Let’s Encrypt SSL certificate on Apache, follow these steps:

  1. Install Certbot on the server by running the following command:

Copy

sudo apt-get install certbot python3-certbot-apache

  1. Obtain the SSL certificate by running the following command:

Copy

sudo certbot --apache -d example.com -d www.example.com

Replace example.com with your domain name.

  1. Follow the prompts to configure the SSL certificate.
  2. Update the Apache virtual host configuration to use the SSL certificate by adding the following lines:

Copy

SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

Replace example.com with your domain name.

  1. Restart Apache by running the following command:

Copy

sudo systemctl restart apache2

After completing these steps, the SSL certificate should be trusted on other devices.

Credit to https://laracasts.com/discuss/channels/laravel/host-https-laravel-using-apache-to-other-devices

Get Date Difference between Two Date in PHP (Year Month Day)


<?php

$StartDate='2010-02-20';
$EndDate='2011-12-01';
//This function take two parameter
//Start date and end Date

function Get_Date_Difference($start_date, $end_date)
{
$diff = abs(strtotime($end_date) - strtotime($start_date));
$years = floor($diff / (365*60*60*24));
$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
echo $years.' Years '.$months.' Month '.$days.' Days';
}

//call the function from where you need

echo Get_Date_Difference($StartDate,$EndDate);

// you will get result (1 Years 9 Month 14 Days)

?>

laravel 5.5 sentry boilerplate

Features:
Sentinel is a complete refactor of our popular Sentry authentication & authorization library. Everything you admired plus a whole lot more.

Authentication.
Authorization.
Registration.
Users & Roles Management.
Driver based permission system.
Flexible activation scenarios.
Reminders (password reset).
Inter-account throttling with DDoS protection.
Custom hashing strategies.
Multiple sessions.
Multiple login columns.
Integration with Laravel.
Allow use of multiple ORM implementations.
Native facade for easy usage outside Laravel.
Interface driven (your own implementations at will).

source code: https://github.com/eaktadiur/Laravel-5.5-sentinel-Boilerplate