• Link to X
  • Link to Facebook
  • Link to Instagram
  • Link to Pinterest
  • Link to LinkedIn
  • Link to Mail
  • Link to WhatsApp
  • Website Services
  • Development Consultation
  • REQUEST QUOTE
Sams Tech
  • Home
  • IT Solutions
    • IT And Support Solutions
    • Network Management Support
    • Computer Repair Services
    • Remote Support
    • Infrastructure Design
    • Mobile Device Management
    • Website Management Services
    • Antivirus Protection
    • Printer Maintenance
    • Customer Service Request
  • Design
    • Design
      • Website Design
      • WordPress Website Design
      • Business Stationery Design
      • Creative Graphic & Logo Designs
      • WooCommerce Store
    • Digital Marketing Services
      • SMM
        • Social Media Marketing
      • SEO
        • SEO
      • SEM
      • Content Writing
      • Email Marketing
    • Security & Migration Services
      • Website Security
      • WordPress Security
      • Website Maintenance | Migration
  • Development
    • Web Development Services
    • WordPress Web Development
    • WooCommerce Store
    • eCommerce Website Development
    • Mobile App Development
    • Woocommerce Speed Optimization Services
  • Mobile
    • Mobile Device Management
    • Mobile App Development
  • Cloud Hosting
  • Company
    • Company
      • About Us
      • Features
      • Contact Us
      • Blog Tutorial
      • Support Center
      • Legal
        • Privacy Policies
        • Terms of Services
        • Cookie Policy
        • Acceptable Use Policy
    • Core Services
      • IT And Support Solutions
      • Network Management Support
      • Computer Repair Services
      • Remote Support
      • Infrastructure Design
      • Mobile Device Management
      • Website Management Services
      • Antivirus Protection
      • Printer Maintenance
    • Webs Services
      • Design Services
        • Website Design
        • WordPress Website Design
        • Creative Graphic & Logo Designs
        • Business Stationery Design
        • WooCommerce Store
        • Digital Marketing Request
      • Development Services
        • Web Development Services
        • WordPress Web Development
        • WooCommerce Store
        • Woocommerce Speed Optimization Services
        • eCommerce Website Development
    • Mobile Services
  • Support
    • Support
    • Talk To An Expert
    • Live Chat & Support Center
    • Contact Us
  • Tutorials
  • CLIENTS
    • Customer IT Services Portal
    • My Hosting Account
    • My Internet Services & Usage
  • Menu Menu

Archive for category: Hosting

You are here: Home1 / Blog Tutorial2 / Hosting

Force HTTPS (Cloudflare Flexible SSL)

in Hosting, Service, Web Development
Read more
https://www.samstech.net/storage/2019/12/HTTP-to-HTTPS-Deploy-SSL-for-Free-Using-Cloudflare.png 445 800 sam /inc/uploads/2018/01/logo-300x206.png sam2019-12-13 19:37:002019-12-21 20:56:57Force HTTPS (Cloudflare Flexible SSL)

Quality Website Hosting

in Hosting, Service
Read more
https://www.samstech.net/storage/2019/10/samstech-Quality-Website-Hosting.png 643 1024 sam /inc/uploads/2018/01/logo-300x206.png sam2019-10-31 22:06:442020-02-16 21:50:37Quality Website Hosting

How To Force HTTPS Using The htaccess File

in Hosting

To Force HTTPS Using The htaccess File

Simply enter this code on your .htaccess file in the website root

# Force HTTPS
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

On a website created in a sub-folder, for example folder “/folder/”, use this:
# Force HTTPS
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} folder
RewriteRule ^(.*)$ https://www.example.com/folder/$1 [R,L]

https://www.samstech.net/storage/2018/11/how-to-force-https.png 300 900 sam /inc/uploads/2018/01/logo-300x206.png sam2018-11-25 15:30:152020-01-08 03:05:43How To Force HTTPS Using The htaccess File

How To Get Free SSL With Free Hosting On Sams Tech Hosting

in Hosting
Read more
/inc/uploads/2018/01/logo-300x206.png 0 0 sam /inc/uploads/2018/01/logo-300x206.png sam2018-11-25 14:54:162018-11-25 14:54:16How To Get Free SSL With Free Hosting On Sams Tech Hosting

Ubuntu PHP Application Clustering with Mod Proxy

in Hosting, Service, Web Development

What is Clustering

Clustering is the technique of linking many computers together to act like a single computer. Generally, a PHP cluster is composed of multiple webservers running PHP individually which then is load-balanced either by a hardware or a software based load balancer. Common examples of hardware load balancer could be F5 BigIP, Nortel’s (Alteon), AceDirector AD3 etc and software load balancer are Apache httpd server, Nginx etc.

Requirements for PHP Cluster

To set a PHP cluster, following are required:

  1. Three Linux servers – One server as a load balancer and other two as the PHP application nodes. They can run any Linux OS. We would be using Debian 9 and CentOS 64bits edition in these three environments in two separate examples. We will refer to load balancer node as LB and the application nodes as s1 and s2 respectively from now.
  2. Apache httpd v2.5 with mod_rewrite, mod_proxy – Apache httpd should be installed on all the three servers with the support of mod_rewrite, mod_proxy, mod_proxy_http modules.
  3. PHP – PHP should be installed on the two Linux servers acting as application nodes (s1 and s2). You can refer my earlier post – The Perfect LAMP Stack to setup the application nodes. We will use PHP only for testing our cluster setup.

Theory of Operation

The setup will make load balancer (LB) to act as the reverse proxy in front of the application nodes (A1 and A2). When a client will send the request to our server, the LB will pass it to the application nodes based on a predefined method as set by us in the Apache httpd configuration.

How to cluster with PHP Debian

After installing the above mentioned applications, to setup the PHP clusters, now we only require to create Apache httpd configuration on LB server to make it act like a reverse proxy.

Open the VirtualHost file default in /etc/apache2/sites-available

  • ServerName will have your URL or ip for the load balancer (LB) server.

ServerName lb.example.com

  • DocumentRoot will be your path to publicly available documents.

DocumentRoot /var/www/

  • ProxyRequests off will prevent your load balancer to act as a forward proxy server.

Note: When you compile mod_proxy with Apache httpd, it can allow you to use the server to act either as a forward proxy or reverse proxy server. The above setting is just used for prevention.

ProxyRequests Off

  • directive will allow you to enforce rules upon the proxied content. Here you can set what constraint you want to apply on the proxied content for e.g. you can only allow few ip range to access the load balancer. In our case we are going to allow from all as it is the load balancer in front of public.

  <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

  • ProxyPass directive will configure the url mapping from the reverse proxy server to the application nodes. You can also configure which url should be translated and sent to backend and which should not. In the following settings, we have configured that when the /balancer-manager is requested, it should not be sent to the backend whereas all other requests should be forwarded there. The balancer://mycluster/ defines our clusters where we will transmit the load and which we will be configuring in next step. The stickysession directive is used here for the sessions which I will explain later in some other post. nofailover directive is related to sessions.

ProxyPass /balancer-manager !

ProxyPass / balancer://mycluster/ stickysession=PHPSESSID $

ProxyPassReverse / http://s1.example.com/

ProxyPassReverse / http://s2.example.com/

  • Once again, we would be defining the directive, but this time we will be using it to enhouse our balancer configurations. The BalancerMember directive is used to add the add the application nodes to the cluster and as of our configuration, we are going to add our two application nodes a1 and a2. The route directive value will be appended to the session id. The ProxySet directive is used to define the additional balancer configuration parameters. In our case, we are going to define the load balancing method which we are going to use in the lbmethod parameter and that is byrequests. The other available methods are bytraffic and bybusyness. To know more about load balancing methods, please refer to https://httpd.apache.org/docs/trunk/mod/mod_proxy.html

  <Proxy balancer://mycluster>
                BalancerMember http://s1.example.com  route=s1
                BalancerMember http://s2.example.com  route=s2
 
                ProxySet lbmethod=byrequests
        </Proxy>

  • Next, we have defined the settings of the balancer-manager which allows us to view the dynamic update of balancer members i.e. the application nodes. You would be requiring to enable mod_status module in Apache httpd to use the balancer-manager

<Location /balancer-manager>
                SetHandler balancer-manager
                Order deny,allow
                Allow from all
        </Location>

Note: We have explained the very basic settings here to setup the Apache httpd to act as a reverse proxy load balancer. You can fine tune the settings according to your needs and to know more about the available options, please refer to http://httpd.apache.org/docs/current/mod/mod_proxy.html

  • The complete settings which we have explained earlier can be seen below:

<VirtualHost *:80>
        ServerName lb.example.com
        DocumentRoot /var/www/
        ProxyRequests Off
 
        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
 
                ProxyPass /balancer-manager !
                ProxyPass / balancer://mycluster/ stickysession=PHPSESSID $
                ProxyPassReverse / http://s1.example.com/
                ProxyPassReverse / http://s2.example.com/
        <Proxy balancer://mycluster>
                BalancerMember http://s1.example.com  route=s1
                BalancerMember http://s2.example.com  route=s2
                ProxySet lbmethod=byrequests
        </Proxy>
 
        <Location /balancer-manager>
                SetHandler balancer-manager
                Order deny,allow
                Allow from all
        </Location>
</VirtualHost>

  • Save the default VirtualHost after making the above settings and restart the server. That will complete our task of creating Apache httpd as reverse proxy load balancer server.

Testing PHP Cluster

Now, to test your PHP cluster setup, create a file test.php in your application nodes s1 and s2. The source code for the file would be very simple and as below: For s1 node,

<?php
 echo ‘Hi, I am from Server 1’;
 ?>
For s2 node, 
<?php
 echo ‘Hi, I am from Server 2’;
 ?>

  • After creating these files, try to load these files from your load balancer url i.e. http://lb.example.com/test.php for multiple times.
  • To see, how your load balancer is performing and if you have set it up as explained earlier, you can visit the url http://lb.example.com/balancer-manager
Read more
https://www.samstech.net/storage/2018/07/linux-load-balancing.jpeg 565 700 sam /inc/uploads/2018/01/logo-300x206.png sam2018-07-06 21:25:492019-12-21 17:51:37Ubuntu PHP Application Clustering with Mod Proxy

Sams Tech Networks always happy to serve you

in Hosting, ISP, Offers, Service, Web Development

Welcome to Sam’s Tech – IT Support Solutions and Service Management,

Internet Service Provider Cable & Wireless.

Fastest, Cheapest, and Most Reliable!

We always happy to serve you!

#ITSolutions  #Service #ISP #WISP #Internet

https://www.samstech.net/storage/2017/08/always-happy-to-serve-you.jpg 510 1545 sam /inc/uploads/2018/01/logo-300x206.png sam2017-08-12 22:10:542020-06-10 20:00:13Sams Tech Networks always happy to serve you
  • Force HTTPS (Cloudflare Flexible SSL)samstech.net
    Force HTTPS (Cloudflare Flexible SSL)December 13, 2019 - 7:37 pm
  • Quality Website HostingOctober 31, 2019 - 10:06 pm
  • How To Force HTTPS Using The htaccess FileNovember 25, 2018 - 3:30 pm
  • How To Get Free SSL With Free Hosting On Sams Tech HostingNovember 25, 2018 - 2:54 pm
  • Ubuntu PHP Application Clustering with Mod ProxyJuly 6, 2018 - 9:25 pm

Stay in touch from your home or office with incredibly fast Solutions!

Advertise hereAdvertise here

SamsTech LLC

WHERE TO FIND US

30 N Gould St Ste N
Sheridan, WY 82801 HelpDesk (at) samstech (dot) net smas 03

Help Desk Center / Support Portal

USEFUL LINKS

Website Services

IT Services

Design Services

Development Services

Search Engine Optimization Services

Web Security Services

Mobile Development

Tutorials

LIVE SUPPORT

Facebook Message Us
WHATSAPP US
CLICK TO CHAT NOW
TELEGRAM US
CALLBACK

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This contact form is deactivated because you refused to accept Google reCaptcha service which is necessary to validate any messages sent by the form.

OUR NEWSLETTER & SPECIAL OFFERS

PAYMENT OPTIONS

PAYPAL

SAFE AND SECURE ONLINE PAYMENTS WITH PAYPAL CREDIT OR ANY MAJOR CREDIT/DEBIT CARD

 

BANK DEPOSIT/TRANSFER

MAKE A CASH DEPOSIT OR TRANSFER.

 

Copyright © - Sams Tech LLC. All Rights Reserved.
  • Link to X
  • Link to Facebook
  • Link to Instagram
  • Link to Pinterest
  • Link to LinkedIn
  • Link to Mail
  • Link to WhatsApp
  • Terms of Service
  • Privacy Policies
Scroll to top Scroll to top Scroll to top

This site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.

OKLearn more×

Cookie and Privacy Settings



How we use cookies

We may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.

Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.

Essential Website Cookies

These cookies are strictly necessary to provide you with services available through our website and to use some of its features.

Because these cookies are strictly necessary to deliver the website, refusing them will have impact how our site functions. You always can block or delete cookies by changing your browser settings and force blocking all cookies on this website. But this will always prompt you to accept/refuse cookies when revisiting our site.

We fully respect if you want to refuse cookies but to avoid asking you again and again kindly allow us to store a cookie for that. You are free to opt out any time or opt in for other cookies to get a better experience. If you refuse cookies we will remove all set cookies in our domain.

We provide you with a list of stored cookies on your computer in our domain so you can check what we stored. Due to security reasons we are not able to show or modify cookies from other domains. You can check these in your browser security settings.

Google Analytics Cookies

These cookies collect information that is used either in aggregate form to help us understand how our website is being used or how effective our marketing campaigns are, or to help us customize our website and application for you in order to enhance your experience.

If you do not want that we track your visit to our site you can disable tracking in your browser here:

Other external services

We also use different external services like Google Webfonts, Google Maps, and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.

Google Webfont Settings:

Google Map Settings:

Google reCaptcha Settings:

Vimeo and Youtube video embeds:

Other cookies

The following cookies are also needed - You can choose if you want to allow them:

Privacy Policy

You can read about our cookies and privacy settings in detail on our Privacy Policy Page.

Privacy Policy
Accept settingsHide notification only