Explorar el Código

Ajout mod_expires Apache

RT#1744
Teddy Cornaut hace 1 año
padre
commit
12fb92f112

+ 26
- 13
dicos/61_pve.xml Ver fichero

@@ -12,6 +12,7 @@
12 12
 
13 13
         <file filelist='mse-apache' name='/etc/apache2/sites-available/mse.conf' source='msebundle-apache.conf' mkdir='True' rm='True'/>
14 14
         <file filelist='mse-apache' name='/etc/apache2/mods-available/mpm_event.conf' mkdir='True' rm='True'/>
15
+        <file filelist='mse-apache' name='/etc/apache2/mods-available/mpm_worker.conf' mkdir='True' rm='True'/>
15 16
         <file filelist='mse-apache' name='/etc/php5/fpm/pool.d/mse.conf' source='mse-fpm.conf' mkdir='True' rm='True'/>
16 17
 
17 18
         <service servicelist='svApache'>apache2</service>
@@ -28,8 +29,8 @@
28 29
         <container name='web'>
29 30
             <!-- services de configuration de l'application  -->
30 31
             <file filelist='pve' name='/var/www/html/mse/app/config/parameters.yml' source='pvebundle-parameters.yml' rm='True' mkdir="True"/>
31
-      		<file filelist='pve' name='/var/www/html/mse/scripts/scribe-post-install.sh' source='mse-scribe-post-install.sh' rm='True' mkdir="True"/>
32
-			<file filelist='pve' name='/var/www/html/mse/app/config/redis.yml' source='mse-redis.yml' rm='True' mkdir="True"/>
32
+              <file filelist='pve' name='/var/www/html/mse/scripts/scribe-post-install.sh' source='mse-scribe-post-install.sh' rm='True' mkdir="True"/>
33
+            <file filelist='pve' name='/var/www/html/mse/app/config/redis.yml' source='mse-redis.yml' rm='True' mkdir="True"/>
33 34
         </container>
34 35
     </containers>
35 36
 
@@ -116,9 +117,9 @@
116 117
             <variable name='pvebundle_redisport'         type='string' description="Port du serveur Redis" mandatory="True">
117 118
                 <value>6379</value>
118 119
             </variable>
119
-			<variable name='pvebundle_redisweight'		type='string' description="Poids du serveur" mandatory="True">
120
-				<value>10</value>
121
-			</variable>
120
+            <variable name='pvebundle_redisweight'        type='string' description="Poids du serveur" mandatory="True">
121
+                <value>10</value>
122
+            </variable>
122 123
             <variable name='pvebundle_redisttl'         type='string' description="TTL de la session Redis" mandatory="True">
123 124
                 <value>3600</value>
124 125
             </variable>
@@ -158,7 +159,7 @@
158 159
             </variable>
159 160
             <variable name='saml_sp_single_logout_service_binding' type='string' description="SP logout service binding" mandatory="False">
160 161
                 <value>test</value>
161
-	</variable>
162
+    </variable>
162 163
             <variable name='saml_sp_name_id_format' type='string' description="SP Name ID Format" mandatory="False">
163 164
                 <value>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</value>
164 165
             </variable>
@@ -420,6 +421,9 @@
420 421
         </family>
421 422
 
422 423
         <family name='MSE-Apache'>
424
+            <variable name='mseApacheServerLimit' type='string' description='Limite supérieure de la définition du nombre de processus (ServerLimit)' >
425
+                   <value>16</value>
426
+            </variable>
423 427
             <variable name='mseApacheStartServers' type='string' description='Nombre initial de process' >
424 428
                    <value>2</value>
425 429
             </variable>
@@ -444,6 +448,12 @@
444 448
         </family>
445 449
 
446 450
         <family name='MSE-PHP-FPM'>
451
+            <variable name='mseFpmMode' type='string' description='Mode de création de processus' >
452
+                   <value>dynamic</value>
453
+            </variable>
454
+            <variable name='mseFpmProcessIDLETimeout' type='number' description="Temps d'inactivité avant la mort du process (secondes)">
455
+                <value>10</value>
456
+            </variable>
447 457
             <variable name='mseFpmMaxChildren' type='string' description='Nombre maximum de process' >
448 458
                    <value>200</value>
449 459
             </variable>
@@ -493,6 +503,9 @@
493 503
     </variables>
494 504
 
495 505
     <constraints>
506
+        <check name='valid_enum' target='mseFpmMode'>
507
+            <param>['dynamic','ondemand']</param>
508
+        </check>
496 509
         <check name='valid_enum' target='mse_lr_apache_period'>
497 510
             <param>['daily', 'weekly', 'monthly', 'yearly']</param>
498 511
         </check>
@@ -576,13 +589,13 @@
576 589
             <target type='variable'>pvebundle_redisport</target>
577 590
             <target type='variable'>pvebundle_redisttl</target>
578 591
             <target type='variable'>pvebundle_redisweight</target>
579
-    	</condition>
580
-		
581
-		<!-- Redis configuration multiple hosts -->
582
-		<group master="pvebundle_redisserveur">
583
-	    	<slave>pvebundle_redisport</slave>
584
-	    	<slave>pvebundle_redisweight</slave>
585
-		</group>
592
+        </condition>
593
+        
594
+        <!-- Redis configuration multiple hosts -->
595
+        <group master="pvebundle_redisserveur">
596
+            <slave>pvebundle_redisport</slave>
597
+            <slave>pvebundle_redisweight</slave>
598
+        </group>
586 599
 
587 600
 
588 601
     </constraints>

+ 3
- 1
postservice/61-pve Ver fichero

@@ -34,7 +34,7 @@ function synchroHost()
34 34
 
35 35
     echo "#### Synchro Apache MPM"
36 36
     rsync -e ssh -av \
37
-    --include="mpm_event.conf" \
37
+    --include="mpm_worker.conf" \
38 38
     /etc/apache2/mods-available/ root@${hst}:/etc/apache2/mods-available/
39 39
 
40 40
     echo "#### Synchro PHP-FPM"
@@ -59,6 +59,8 @@ function synchroHost()
59 59
     cmd="${cmd} chmod -R g+rw app/{cache,logs,spool,webservices};"
60 60
 
61 61
     # Activation mods apache
62
+    cmd="${cmd} a2dismod mpm_event;"
63
+    cmd="${cmd} a2enmod mpm_worker;"
62 64
     apacheMods="proxy_fcgi rewrite expires"
63 65
 
64 66
 	for mod in ${apacheMods}

+ 3
- 0
posttemplate/61-pve Ver fichero

@@ -9,6 +9,9 @@ if [ -f /etc/nginx/sites-available/mse-nginx.conf ]; then
9 9
 fi
10 10
 
11 11
 # Apache conf
12
+a2dismod mpm_event
13
+a2enmod mpm_worker
14
+
12 15
 apacheMods="proxy_fcgi rewrite expires"
13 16
 
14 17
 for mod in ${apacheMods}

+ 1
- 1
scripts/apacheSync.sh Ver fichero

@@ -16,7 +16,7 @@ then
16 16
 	cmd=""
17 17
     # Redémarrage service nginx
18 18
 	# Apache conf
19
-	apacheMods="proxy_fcgi rewrite"
19
+	apacheMods="proxy_fcgi rewrite expires"
20 20
 
21 21
 	for mod in ${apacheMods}
22 22
 	do

+ 1
- 0
tmpl/mpm_event.conf Ver fichero

@@ -6,6 +6,7 @@
6 6
 # MaxRequestWorkers: maximum number of worker threads
7 7
 # MaxConnectionsPerChild: maximum number of requests a server process serves
8 8
 <IfModule mpm_event_module>
9
+    ServerLimit              %%mseApacheServerLimit
9 10
     StartServers             %%mseApacheStartServers
10 11
     MinSpareThreads          %%mseApacheMinSpareThreads
11 12
     MaxSpareThreads          %%mseApacheMaxSpareThreads

+ 20
- 0
tmpl/mpm_worker.conf Ver fichero

@@ -0,0 +1,20 @@
1
+# event MPM
2
+# StartServers: initial number of server processes to start
3
+# MinSpareThreads: minimum number of worker threads which are kept spare
4
+# MaxSpareThreads: maximum number of worker threads which are kept spare
5
+# ThreadsPerChild: constant number of worker threads in each server process
6
+# MaxRequestWorkers: maximum number of worker threads
7
+# MaxConnectionsPerChild: maximum number of requests a server process serves
8
+<IfModule mpm_event_module>
9
+    ServerLimit              %%mseApacheServerLimit
10
+    StartServers             %%mseApacheStartServers
11
+    MinSpareThreads          %%mseApacheMinSpareThreads
12
+    MaxSpareThreads          %%mseApacheMaxSpareThreads
13
+    ThreadLimit              %%mseApacheThreadLimit
14
+    ThreadsPerChild          %%mseApacheThreadsPerChild
15
+    MaxRequestWorkers        %%mseApacheMaxRequestWorkers
16
+    MaxConnectionsPerChild   %%mseApacheMaxConnectionsPerChild
17
+</IfModule>
18
+MaxKeepAliveRequests 20
19
+
20
+# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

+ 14
- 1
tmpl/mse-fpm.conf Ver fichero

@@ -9,12 +9,25 @@ listen.allowed_clients = 127.0.0.1
9 9
 listen.owner = www-data
10 10
 listen.group = www-data
11 11
 
12
-pm = dynamic
12
+pm = %%mseFpmMode
13 13
 pm.max_children = %%mseFpmMaxChildren
14
+%if %%mseFpmMode == "dynamic"
14 15
 pm.start_servers = %%mseFpmStartServers
15 16
 pm.min_spare_servers = %%mseFpmMinSpareThreads
16 17
 pm.max_spare_servers = %%mseFpmMaxSpareThreads
18
+%end if
17 19
 pm.max_requests = %%mseFpmMaxRequest
20
+%if %%mseFpmMode == 'ondemand'
21
+pm.process_idle_timeout = %%mseFpmProcessIDLETimeout
22
+%end if
23
+
24
+request_terminate_timeout = 60
25
+request_slowlog_timeout = 10s
26
+slowlog = /var/log/$pool.fpm.slow.log
27
+
28
+#catch_workers_output = yes
29
+#php_admin_value[error_log] = /var/log/$pool.fpm.error.log
30
+#php_admin_flag[log_errors] = on
18 31
 
19 32
 access.log = /var/log/$pool.access.log
20 33
 chdir = /

+ 1
- 1
tmpl/mse-redis.yml Ver fichero

@@ -12,7 +12,7 @@ snc_redis:
12 12
     session:
13 13
         client: cluster
14 14
         prefix: mse
15
-        ttl: %cnous_pve.redis.ttl%
15
+        ttl: %%pvebundle_redisttl 
16 16
         locking: false
17 17
     doctrine:
18 18
         metadata_cache:

+ 5
- 0
tmpl/msebundle-apache.conf Ver fichero

@@ -31,6 +31,11 @@
31 31
         AllowOverride All
32 32
         Require all granted
33 33
     </Directory>
34
+    
35
+    <FilesMatch "\.(png|jp?g|gif|ico|css|map|woff?|eot|svg|ttf|js|json|pdf)">
36
+        ExpiresActive on
37
+        ExpiresDefault "access plus 1 weeks"
38
+    </FilesMatch>    
34 39
 
35 40
     # uncomment the following lines if you install assets as symlinks
36 41
     # or run into problems when compiling LESS/Sass/CoffeeScript assets

Loading…
Cancelar
Guardar