HTTP/2 Enable at Nginx Server


To enable http2, just add http2 text at below lines of nginx virtual host file path /etc/nginx/sites-available/


listen [::]:443 ssl ipv6only=on http2; 
listen 443 ssl http2;

After saving it reload the nginx server


sudo service nginx reload 

Check http/2 enabled or not from here: https://http2.pro/

How to setup local virtual host on ubuntu lampp server


Open your terminal and run this command to setup hosts local ip mapping. Install vim if not exist



> sudo vim /etc/hosts

//Add this line and save
127.0.0.1   mytestdomain.com


Now go to your lampp etc folder


> cd /opt/lampp/etc/

Open httpd.conf file from etc folder to edit


> sudo vim httpd.conf

un-comment below line from httpd.conf file


# Virtual hosts
Include etc/extra/httpd-vhosts.conf

Now go inside extra folder and open httpd-vhosts.conf file to edit


> cd /opt/lampp/etc/extra/
> sudo vim httpd-vhosts.conf 

Add below lines of code at the very bottom the of file



<VirtualHost *:80>
    DocumentRoot "/opt/lampp/htdocs/project/webroot"
    ServerName mytestdomain.com
    DirectoryIndex index.php
    <Directory "/opt/lampp/htdocs/project/webroot">
      Require all granted
    </Directory>
</VirtualHost>    
              

Finally restart lampp server with below command


> sudo /opt/lampp/lampp restart

Thats all.

Now you can browse your local project through this url: http://mytestdomain.com

CakePHP application run without mod_rewrite activation on server


Some shared server can not provide to read/write .htaccess file for which cakephp application can not run properly on those server. here is the simple solution to overcome these situation. just follow the below steps to make it workable on any server.

To configure CakePHP *not* to use mod_rewrite and to use CakePHP pretty URLs, remove these .htaccess files:


   /.htaccess
   /app/.htaccess
   /app/webroot/.htaccess
 

Uncomment the App.baseUrl line from core file :

File location : /app/Config/core.php


   Configure::write('App.baseUrl', env('SCRIPT_NAME'));
 

Virtual Host configuration for windows operating system ( XAMPP SERVER )


Virtual Host configuration for windows operating system ( XAMPP SERVER ).

1. Open the file hosts from ( C:\Windows\System32\drivers\etc\hosts )

127.0.0.1   www.testurl.com

2. Then open the httpd-vhosts.conf for xampp server from (  C:\xampp\apache\conf\extra\httpd-vhosts.conf )

# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
    DocumentRoot C:/xampp/htdocs/
    ServerName localhost
    ServerAdmin admin@localhost
</VirtualHost>

# This is the configuration for www.testurl.com
<VirtualHost *:80>
    DocumentRoot "C:\wamp\www\project_dir"
    ServerName www.testurl.com
    DirectoryIndex index.php
    <Directory C:/wamp/www/>
      Order Deny,Allow   
      Allow from all 
    </Directory>
</VirtualHost>