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 11:21] admingetting_started:18_install_ubuntu_nginx [2019/12/19 12:27] (current) – [Install RADIUSdesk] admin
Line 158: Line 158:
                 include snippets/fastcgi-php.conf;                 include snippets/fastcgi-php.conf;
         #         #
-        #       # With php7.0-cgi alone: +        #       # With php-fpm (or other unix sockets):
-        #       fastcgi_pass 127.0.0.1:9000; +
-        #       # With php7.0-fpm+
-        #        fastcgi_pass unix:/run/php/php7.0-fpm.sock;+
         # ===HEADS-UP We use 7.2 and NOT 7.0 as commented out ===         # ===HEADS-UP We use 7.2 and NOT 7.0 as commented out ===
-                  fastcgi_pass unix:/run/php/php7.2-fpm.sock; +                fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; 
-        }+        #       # With php-cgi (or other tcp sockets): 
 +        #       fastcgi_pass 127.0.0.1:9000; 
 +     }
 </code> </code>
   * Enable the hiding of .htaccess files   * Enable the hiding of .htaccess files
Line 196: 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 213: Line 213:
 sudo systemctl restart mysql.service sudo systemctl restart mysql.service
 </code> </code>
- 
  
 ----- -----
Line 227: 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 236: 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 266: 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 358: 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 426: 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]]