Presentation is loading. Please wait.

Presentation is loading. Please wait.

Speeding Up Alfresco and Share using Nginx Reverse/Caching Frontend Proxy Ishara Fernando Senior Linux Systems Administrator.

Similar presentations


Presentation on theme: "Speeding Up Alfresco and Share using Nginx Reverse/Caching Frontend Proxy Ishara Fernando Senior Linux Systems Administrator."— Presentation transcript:

1 Speeding Up Alfresco and Share using Nginx Reverse/Caching Frontend Proxy Ishara Fernando Senior Linux Systems Administrator

2 Key Considerations For a content Management application based on web, we should consider the following such as Proxy request so that application ports shouldn’t be exposed to the outside world Caching Content for High performance Webpage loading speed Load balancing for High performance

3 Key Considerations For a content Management application based on web, we should consider the following such as Proxy request so that application ports shouldn’t be exposed to the outside world Caching Content for High performance Webpage loading speed Load balancing for High performance

4 Choose the Web Proxy Server Considering the requirement and the key list of performance criteria, we have the following options for the web proxy Apache Nginx Oracle Weblogic Windows IIS Lighthttpd IBM HTTP Server

5 Why Nginx, not Apache ? NginxApache Event DrivenProcess Driven Does not Create a New process for each request Creates a New process for each request Best for serving Static Page content (Such as Alfresco) Best for serving Dynamic Pages Performance doesn’t rely on the underlying hardware Performance rely on the underlying hardware

6 Reverse Proxy for Alfresco When do we use Nginx as a Reverse Proxy ?

7 Reverse Proxy for Alfresco & Share ## Example Reverse proxy configuration for /alfresco and /share location / { rewrite ^/$ /share; } location /share { proxy_pass https://127.0.0.1:8443/share ;https://127.0.0.1:8443/share } location /alfresco { proxy_pass https://127.0.0.1:8443/alfresco ;https://127.0.0.1:8443/alfresco }

8 Reverse Proxy for Alfresco & Share ## Example Reverse proxy configuration for /alfresco and /share location / { rewrite ^/$ /share; } location /share { proxy_pass https://127.0.0.1:8443/share ;https://127.0.0.1:8443/share } location /alfresco { proxy_pass https://127.0.0.1:8443/alfresco ;https://127.0.0.1:8443/alfresco }

9 Force SSL for Nginx and compress http Requests ## SSL configurations for Nginx server { listen 443; server_name someurl.com; ssl on; ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate_key /etc/nginx/ssl/key.pem; gzip on; gzip_comp_level 1; gzip_proxied any; } #Force Rewrite URL From “http” to “https” server { listen 80; server_name someurl.com; location / { rewrite ^(.*) https://someurl.com$1 permanent; }

10 Caching Content of Alfresco Why cache content of Alfresco ?

11 Caching Content on Disk ##An Example HTTP Block configuration for caching content on Local Disk http { include /etc/nginx/mime.types; default_type application/octet-stream; proxy_buffering on; proxy_cache_path /var/cache/nginx keys_zone=alfresco-cache:1512m inactive=1d; } location /share { proxy_pass https://127.0.0.1:8443/share; proxy_cache alfresco-cache; } location /alfresco { proxy_pass https://127.0.0.1:8443/alfresco; proxy_cache alfresco-cache; }

12 Caching Web Assets ## Forcing Web Browsers to Cache CSS, JS, etc location ~ (\.js$|\.css$|\.gif$|\.woff$|\.ttf$|\.eot$|^/images/|^/icons/) { add_header Cache-Control public; expires 7d; } ## Forcing Nginx to cache Document Thumbnail Images on Disk, but NOT by the Web Browser location ~ (^/share/.*/thumbnails/.*$) { proxy_cache_valid 200 301 302 10m ; expires 20m ; proxy_pass http://someurl.com ;http://someurl.com proxy_cache alfresco-cache ; }

13 Speeding up Webpage loading of Alfresco Nginx pagespeed module can be used to increase the performance of loading of Alfresco. Below are the results of web performance tests before and after configuring Nginx pagespeed module Before Configuring Nginx Pagespeed Module After Configuring Nginx Pagespeed Module

14 Speeding up Webpage loading of Alfresco Nginx pagespeed module can be used to increase the performance of loading of Alfresco. Below are the results of web performance tests before and after configuring Nginx pagespeed module Before Configuring Nginx Pagespeed Module After Configuring Nginx Pagespeed Module

15 Nginx Pagespeed Module for speeding up webpage loading ## Below is an example block of configurations which utilizes the Nginx pagespeed module http { pagespeed on; pagespeed FileCachePath /var/ngx_pagespeed_cache; pagespeed EnableFilters combine_css,combine_javascript,rewrite_javascript; }

16 Load balancing across an Alfresco Cluster Nginx has the inbuilt capability of Load balancing incoming requests across an Alfresco Cluster using nginx upstream module.

17 Load balancing Alfresco using Sticky Sessions ## Sticky Sessions in Nginx are available only in Nginx Enterprise Version, but as a Hack we Use “IP_HASH” algorithm to load balance requests between a 2 Node Alfresco Cluster upstream someurl.com {someurl.com ip_hash; server A.B.C.D:8080 max_fails=2 fail_timeout=10s weight=1; server A.B.C.E:8080 max_fails=2 fail_timeout=10s weight=1; }

18 Load balancing Email IMAP Interface of Alfresco ## Make sure php-fm is installed in the Nginx Server, below is a PHP Script for Nginx IMAP Authentication cat /usr/share/nginx/html/mail/auth.php <?php header("Auth-Status: OK"); header("Auth-Server: A.B.C.D"); header("Auth-Port: 993"); ?> ##Nginx Configuration to proxy for PHP-CGI Server running on port:9000 location ~ \.php$ { root /usr/share/nginx/html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

19 Load balancing Email IMAP Interface of Alfresco upstream mail-alfresco { ip_hash; server A.B.C.D:993 max_fails=2 fail_timeout=10s weight=1; server A.B.C.E:993 max_fails=2 fail_timeout=10s weight=1; } mail { auth_http 127.0.0.1:80/mail/auth.php; proxy on; imap_capabilities "IMAP4rev1" "LITERAL+"; server { listen 993; server_name mail-alfresco; ssl on; ssl_certificate /etc/nginx/ssl/mail-alfresco.crt; ssl_certificate_key /etc/nginx/ssl/mail-alfresco.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; protocol imap; }

20 Nginx Failover Configurations ## Below specifies nginx that alfresco node1 is down upstream someurl.com {someurl.com ip_hash; server A.B.C.D:8080 max_fails=2 fail_timeout=10s weight=1 down ; server A.B.C.E:8080 max_fails=2 fail_timeout=10s weight=1; }

21 Troubleshooting caching issues in Nginx By default Nginx stores cache under /var/cache/nginx/* After you have upgraded Alfresco, you might have noticed that Alfresco pages are scattered with Images, then probably its an issue with Nginx Caches. The Solution is to Clear Nginx cache and reload Nginx Service as follows : rm -rf /var/cache/nginx/* /etc/init.d/nginx reload

22 End Of Presentation Thank you !!!! Email : ifernando@zaizi.com


Download ppt "Speeding Up Alfresco and Share using Nginx Reverse/Caching Frontend Proxy Ishara Fernando Senior Linux Systems Administrator."

Similar presentations


Ads by Google