RADIUSdesk

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
getting_started:18_install_ubuntu_nginx [2019/12/19 06:30] admingetting_started:18_install_ubuntu_nginx [2019/12/19 12:27] (current) – [Install RADIUSdesk] admin
Line 26: Line 26:
 ===== HOWTO ===== ===== HOWTO =====
 ==== Networking Introduction on Ubuntu 18.04  ==== ==== Networking Introduction on Ubuntu 18.04  ====
 +  * If you do not yet have a working network configuration on the server you plan to do the installation on, please use this section as reference, else just proceed to the next section.
   * Since there is such a huge difference between the way of doing things in Ubuntu 16.04 and Ubuntu 18.04 we felt that adding this section will help those who are getting used to this newer way of doing things.   * Since there is such a huge difference between the way of doing things in Ubuntu 16.04 and Ubuntu 18.04 we felt that adding this section will help those who are getting used to this newer way of doing things.
   * For this we assume you have a bare VM (like the ones from https://www.osboxes.org/ubuntu-server/ )   * For this we assume you have a bare VM (like the ones from https://www.osboxes.org/ubuntu-server/ )
Line 82: Line 83:
        valid_lft forever preferred_lft forever        valid_lft forever preferred_lft forever
 </code> </code>
 +  * Now that we have a working network setup on our machine we can continue.
 +
 ==== Install Nginx ==== ==== Install Nginx ====
   * We assume you have a clean install of Ubuntu 18.04 **WITHOUT** Apache installed.   * We assume you have a clean install of Ubuntu 18.04 **WITHOUT** Apache installed.
Line 87: Line 90:
   * To remove Apache   * To remove Apache
    <code bash>    <code bash>
-   sudo systemctl start apache2.service+   sudo systemctl stop apache2.service
    sudo apt-get remove apache2    sudo apt-get remove apache2
    </code>    </code>
 </WRAP> </WRAP>
  
 +  * Make sure it is up to date.
 +<code bash>
 +# Get the latest package lists
 +sudo apt-get update
 +# Update the system to the latest
 +sudo apt-get upgrade
 +</code>
   * Ensure the English language pack is installed   * Ensure the English language pack is installed
 <code bash> <code bash>
Line 126: Line 136:
 <code bash> <code bash>
 sudo apt-get install php-fpm sudo apt-get install php-fpm
 +sudo systemctl enable php7.2-fpm
 +sudo systemctl start php7.2-fpm
 </code> </code>
  
Line 146: Line 158:
                 include snippets/fastcgi-php.conf;                 include snippets/fastcgi-php.conf;
         #         #
-        #       # With php7.0-cgi alone:+        #       # With php-fpm (or other unix sockets): 
 +        # ===HEADS-UP We use 7.2 and NOT 7.0 as commented out === 
 +                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; 
 +        #       # With php-cgi (or other tcp sockets):
         #       fastcgi_pass 127.0.0.1:9000;         #       fastcgi_pass 127.0.0.1:9000;
-        #       # With php7.0-fpm: +     }
-                fastcgi_pass unix:/run/php/php7.0-fpm.sock; +
-        }+
 </code> </code>
   * Enable the hiding of .htaccess files   * Enable the hiding of .htaccess files
Line 182: Line 195:
 <code bash> <code bash>
 sudo apt-get install mysql-server php-mysql sudo apt-get install mysql-server php-mysql
 +sudo systemctl enable mysql
 </code> </code>
  
 === Disable strict mode  === === Disable strict mode  ===
-  * With the 16.04 release of MySQL there were some changes to the MySQL configuration which causes problems on the current RADIUSdesk database implementation.+  * With the 18.04 release of MySQL there were some changes to the MySQL configuration which causes problems on the current RADIUSdesk database implementation.
   * We will disable Strict SQL Mode in MySQL 5.7.   * We will disable Strict SQL Mode in MySQL 5.7.
 <code bash> <code bash>
Line 199: Line 213:
 sudo systemctl restart mysql.service sudo systemctl restart mysql.service
 </code> </code>
- 
  
 ----- -----
Line 213: Line 226:
     rewrite ^/cake2/rd_cake/webroot/(.*)$ /cake2/rd_cake/webroot/$1 break;     rewrite ^/cake2/rd_cake/webroot/(.*)$ /cake2/rd_cake/webroot/$1 break;
     rewrite ^/cake2/rd_cake/(.*)$ /cake2/rd_cake/webroot/$1 break;     rewrite ^/cake2/rd_cake/(.*)$ /cake2/rd_cake/webroot/$1 break;
 +    access_log off;
 +    expires max;
 +    add_header Cache-Control public;
 +}
 +
 +location ~ ^/cake3/.+\.(jpg|jpeg|gif|png|ico|js|css)$ {
 +    rewrite ^/cake3/rd_cake/webroot/(.*)$ /cake3/rd_cake/webroot/$1 break;
 +    rewrite ^/cake3/rd_cake/(.*)$ /cake3/rd_cake/webroot/$1 break;
     access_log off;     access_log off;
     expires max;     expires max;
Line 222: Line 243:
 sudo systemctl reload nginx.service sudo systemctl reload nginx.service
 </code> </code>
-=== Compress the text before sending it to client === 
-  * Edit the main config file of **Nginx**. 
-<code bash> 
-sudo vi /etc/nginx/nginx.conf 
-</code> 
-  * Change the compression section to contain the following: 
-<file> 
-gzip on; 
-gzip_disable "msie6"; 
- 
-gzip_vary on; 
-gzip_proxied any; 
-gzip_comp_level 6; 
-gzip_buffers 16 8k; 
-gzip_http_version 1.1; 
-gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; 
- 
-</file> 
-  * Restart Nginx 
-<code bash> 
-sudo systemctl restart nginx.service 
-</code> 
- 
 ---------- ----------
  
Line 252: Line 250:
     * **rd** directory with its contents contains all the HTML and JavaScript code and is used as the presentation layer.     * **rd** directory with its contents contains all the HTML and JavaScript code and is used as the presentation layer.
     * **rd_cake** is a CakePHP application and can be considered the engine room. Here the data is processed before being presented by the presentation layer. **(We currently use one CakePHP v2 and one CakePHP v3 application in order to migrate from CakePHP v2 to CakePHP v3)**     * **rd_cake** is a CakePHP application and can be considered the engine room. Here the data is processed before being presented by the presentation layer. **(We currently use one CakePHP v2 and one CakePHP v3 application in order to migrate from CakePHP v2 to CakePHP v3)**
-    * **rd_login** is a directory with various login pages which are centrally managed through the RADIUSdesk **Dynamic Login Pages** applet. Although this is optional, it is used by most installs.+    * **login** is a directory with various login pages which are centrally managed through the RADIUSdesk **Dynamic Login Pages** applet. Although this is optional, it is used by most installs.
  
   * We will use SVN (subversion) to  check out the latest version (trunk) of RADIUSdesk.   * We will use SVN (subversion) to  check out the latest version (trunk) of RADIUSdesk.
  
 === Install CakePHP === === Install CakePHP ===
-<WRAP center round info 100%> 
-  * As from December 2016 we started a migration process of migrating from CakePHP v2 to CakePHP v3. 
-  * The ORM component of CakePHP v3 is completely new and different which makes the migration fairly involved. 
-  * Since the architecture of RADIUSdesk is following modern design principles it allows us to run both CakePHP v2 and CakePHP v3 simultaneously. 
-  * We can then do the migration gradually over time. 
-</WRAP> 
- 
 == Required packages == == Required packages ==
  
   * Make sure the following packages are installed:   * Make sure the following packages are installed:
 <code bash> <code bash>
-sudo apt-get install php-cli php-gd php-curl php-xml php-mbstring php-intl+sudo apt-get install php-cli php-mysql php-gd php-curl php-xml php-mbstring php-intl 
 </code> </code>
  
 == Install CakePHP v2 == == Install CakePHP v2 ==
  
-  * Download the 2.x version of CakePHP (Version 2.9.as of this writing). https://github.com/cakephp/cakephp/tags+  * Download the 2.x version of CakePHP (Version 2.10.19 as of this writing). https://github.com/cakephp/cakephp/tags
   * There are two formats to choose from when selecting to download, Zip or Tar.gz. Select Tar.gz.   * There are two formats to choose from when selecting to download, Zip or Tar.gz. Select Tar.gz.
   * Copy and extract it inside the directory that Nginx is serving its content from (/usr/share/nginx/html)   * Copy and extract it inside the directory that Nginx is serving its content from (/usr/share/nginx/html)
 <code bash> <code bash>
-sudo cp 2.9.7.tar.gz /usr/share/nginx/html+sudo cp 2.10.19.tar.gz /usr/share/nginx/html
 cd /usr/share/nginx/html cd /usr/share/nginx/html
-sudo tar -xzvf 2.9.7.tar.gz  +sudo tar -xzvf 2.10.19.tar.gz  
-sudo ln -s ./cakephp-2.9../cake2+sudo ln -s ./cakephp-2.10.19 ./cake2
 </code> </code>
-  * Reload php7.0-fpm+  * Reload php7.2-fpm
 <code bash> <code bash>
-sudo systemctl reload php7.0-fpm.service+sudo systemctl reload php7.2-fpm.service
 </code> </code>
  
Line 344: Line 335:
     sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/rd.sql     sudo mysql -u root rd < /usr/share/nginx/html/cake3/rd_cake/setup/db/rd.sql
 </code> </code>
- 
-<WRAP center round tip 80%> 
-  * If you have a small server like a Raspberry Pi you, run the following SQL for better performance. 
-<code sql> 
-use rd; 
-delete from phrase_values where language_id=16 OR language_id=15 or language_id=13 or language_id=5 or language_id=14; 
-</code> 
-</WRAP> 
- 
 === Configure Nginx === === Configure Nginx ===
   * Since CakePHP uses rewrite rules, we have to configure Nginx in such a way as to allow rewriting of the URL's that starts with /cake2/rd_cake or with /cake3/rd_cake.   * Since CakePHP uses rewrite rules, we have to configure Nginx in such a way as to allow rewriting of the URL's that starts with /cake2/rd_cake or with /cake3/rd_cake.
Line 412: Line 394:
 ===== Next steps ===== ===== Next steps =====
   * Be sure to also install **FreeRADIUS** and **Node.js**,   * Be sure to also install **FreeRADIUS** and **Node.js**,
-  * [[Getting Started:install_ubuntu_freeradius_3|Install FreeRADIUS]] +  * [[Getting Started:18_install_ubuntu_freeradius_3|Install FreeRADIUS]] 
-  * [[getting_started:install_ubuntu_node_js|Install node.js]]+  * [[getting_started:18_install_ubuntu_node_js|Install node.js]]