Kaynağa Gözat

Merge pull request #1932 from hestiacp/nginx-agents

Nginx user-agents
Jaap Marcus 4 yıl önce
ebeveyn
işleme
97c0903289

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
 
 ### Features
 
+- Add nginx user_agent separation to desktop/mobile (e.g. for fastcgi cache)
 
 ### Bugfixes
 

+ 17 - 0
install/deb/nginx/agents.conf

@@ -0,0 +1,17 @@
+map $http_user_agent $mobile_request {
+    default desktopversion;
+
+    "~*ipad" mobileversion;
+    "~*android.*mobile" mobileversion;
+    "~*iphone" mobileversion;
+    "~*ipod.*mobile" mobileversion;
+    "~*BlackBerry*Mobile Safari" mobileversion;
+    "~*BB*Mobile Safari" mobileversion;
+    "~*Opera.*Mini/7" mobileversion;
+    "~*IEMobile/10.*Touch" mobileversion;
+    "~*IEMobile/11.*Touch" mobileversion;
+    "~*IEMobile/7.0" mobileversion;
+    "~*IEMobile/9.0" mobileversion;
+    "~*Firefox.*Mobile" mobileversion;
+    "~*webOS" mobileversion;
+}

+ 1 - 0
install/hst-install-debian.sh

@@ -1237,6 +1237,7 @@ echo "[ * ] Configuring NGINX..."
 rm -f /etc/nginx/conf.d/*.conf
 cp -f $HESTIA_INSTALL_DIR/nginx/nginx.conf /etc/nginx/
 cp -f $HESTIA_INSTALL_DIR/nginx/status.conf /etc/nginx/conf.d/
+cp -f $HESTIA_INSTALL_DIR/nginx/agents.conf /etc/nginx/conf.d/
 cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc /etc/nginx/conf.d/
 cp -f $HESTIA_INSTALL_DIR/nginx/phppgadmin.inc /etc/nginx/conf.d/
 cp -f $HESTIA_INSTALL_DIR/logrotate/nginx /etc/logrotate.d/

+ 1 - 0
install/hst-install-ubuntu.sh

@@ -1277,6 +1277,7 @@ echo "[ * ] Configuring NGINX..."
 rm -f /etc/nginx/conf.d/*.conf
 cp -f $HESTIA_INSTALL_DIR/nginx/nginx.conf /etc/nginx/
 cp -f $HESTIA_INSTALL_DIR/nginx/status.conf /etc/nginx/conf.d/
+cp -f $HESTIA_INSTALL_DIR/nginx/agents.conf /etc/nginx/conf.d/
 cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc /etc/nginx/conf.d/
 cp -f $HESTIA_INSTALL_DIR/nginx/phppgadmin.inc /etc/nginx/conf.d/
 cp -f $HESTIA_INSTALL_DIR/logrotate/nginx /etc/logrotate.d/

+ 7 - 1
install/upgrade/versions/1.4.4.sh

@@ -6,9 +6,15 @@
 #######                      Place additional commands below.                   #######
 #######################################################################################
 
+
+if [ -d "/etc/nginx/conf.d/" ]; then
+    #Add nginx user_agent separation to desktop/mobile
+    cp -f $HESTIA_INSTALL_DIR/nginx/agents.conf /etc/nginx/conf.d/
+fi
+
 # Reset PMA SSO to fix bug with Nginx + Apache2 
 if [ "$PHPMYADMIN_KEY" != "" ]; then
     echo "[ * ] Refressh hestia-sso for PMA..."
     $BIN/v-delete-sys-pma-sso 
     $BIN/v-add-sys-pma-sso 
-fi
+fi