Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Created March 9, 2014 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save janikvonrotz/9445729 to your computer and use it in GitHub Desktop.
Save janikvonrotz/9445729 to your computer and use it in GitHub Desktop.
Ubuntu: Install QR code service #PHP #Nginx #Markdown

Introduction

To generate QR codes with php we are using the project QR Generator PHP hosted on GitHub.

Requirements

  • Ubuntu server
  • Nginx
  • Nginx minimal website
  • php5-fpm
  • Nginx php5-fpm website

Installation

Clone project with git.

cd /usr/local/src
sudo git clone https://github.com/janikvonrotz/QR-Generator-PHP.git

Rename the project directory to get a shorter url.

sudo mv QR-Generator-PHP qr

Add the config to one of your Nginx sites.

server{
    
    ...
    
    # change location for QR code requests
    location /qr{
        root /usr/local/src;
        index index.php;
    }
    
    location ~ .php$ {
        
        ...
        
        # change the php root for QR code requests
        if ($request_uri ~* /qr) {
            set $php_root /usr/local/src;
        }
        
        ...
    }
}

Test config and reload Nginx service.

sudo nginx -t && sudo service nginx reload

Test the new QR code service by open a browser on //[host]/qr/?d=example.org.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment