@@ -153,12 +153,9 @@ def pre_pref(self, apt_packages):
153153
154154 if set (EEVariables .ee_nginx ).issubset (set (apt_packages )):
155155 Log .info (self , "Adding repository for NGINX, please wait..." )
156- if EEVariables .ee_platform_distro == 'debian' :
157- Log .debug (self , 'Adding Dotdeb/nginx GPG key' )
158- EERepo .add (self , repo_url = EEVariables .ee_nginx_repo )
159- else :
160- EERepo .add (self , ppa = EEVariables .ee_nginx_repo )
161- Log .debug (self , 'Adding ppa of Nginx' )
156+ EERepo .add (self , repo_url = EEVariables .ee_nginx_repo )
157+ Log .debug (self , 'Adding ppa of Nginx' )
158+ EERepo .add_key (self , EEVariables .ee_nginx_key )
162159
163160 if set (EEVariables .ee_php ).issubset (set (apt_packages )):
164161 Log .info (self , "Adding repository for PHP, please wait..." )
@@ -205,37 +202,16 @@ def post_pref(self, apt_packages, packages):
205202 EEService .reload_service (self , 'postfix' )
206203
207204 if set (EEVariables .ee_nginx ).issubset (set (apt_packages )):
208- if ((not EEShellExec .cmd_exec (self , "grep -q -Hr EasyEngine "
209- "/etc/nginx" )) and os .path .isfile ('/etc/nginx/nginx.conf' )):
210- nc = NginxConfig ()
211- Log .debug (self , 'Loading file /etc/nginx/nginx.conf ' )
212- nc .loadf ('/etc/nginx/nginx.conf' )
213- nc .set ('worker_processes' , 'auto' )
214- nc .append (('worker_rlimit_nofile' , '100000' ), position = 2 )
215- nc .remove (('events' , '' ))
216- nc .append ({'name' : 'events' , 'param' : '' , 'value' :
217- [('worker_connections' , '4096' ),
218- ('multi_accept' , 'on' )]}, position = 4 )
219- nc .set ([('http' ,), 'keepalive_timeout' ], '30' )
220- Log .debug (self , "Writting nginx configuration to "
221- "file /etc/nginx/nginx.conf " )
222- nc .savef ('/etc/nginx/nginx.conf' )
223-
224- # Custom Nginx configuration by EasyEngine
225- if EEVariables .ee_platform_distro == 'ubuntu' :
226- data = dict (version = EEVariables .ee_version ,
227- Ubuntu = True )
228- else :
229- data = dict (version = EEVariables .ee_version ,
230- Debian = True )
231- Log .debug (self , 'Writting the nginx configuration to '
232- 'file /etc/nginx/conf.d/ee-nginx.conf ' )
233- ee_nginx = open ('/etc/nginx/conf.d/ee-nginx.conf' ,
234- encoding = 'utf-8' , mode = 'w' )
235- self .app .render ((data ), 'nginx-core.mustache' ,
236- out = ee_nginx )
237- ee_nginx .close ()
238-
205+ if not (os .path .isfile ('/etc/nginx/common/wpfc.conf' )):
206+ # Change EasyEngine Version in nginx.conf file
207+ EEFileUtils .searchreplace (self , "/etc/nginx/nginx.conf" ,
208+ "# add_header" ,
209+ "add_header" )
210+
211+ EEFileUtils .searchreplace (self , "/etc/nginx/nginx.conf" ,
212+ "\" EasyEngine\" " ,
213+ "\" EasyEngine {0}\" "
214+ .format (EEVariables .ee_version ))
239215 data = dict ()
240216 Log .debug (self , 'Writting the nginx configuration to '
241217 'file /etc/nginx/conf.d/blockips.conf' )
@@ -1475,12 +1451,7 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
14751451 if self .app .pargs .nginx :
14761452 Log .debug (self , "Setting apt_packages variable for Nginx" )
14771453
1478- if EEVariables .ee_platform_distro == 'debian' :
1479- check_nginx = 'nginx-extras'
1480- else :
1481- check_nginx = 'nginx-custom'
1482-
1483- if not EEAptGet .is_installed (self , check_nginx ):
1454+ if not EEAptGet .is_installed (self , 'nginx-custom' ):
14841455 apt_packages = apt_packages + EEVariables .ee_nginx
14851456 else :
14861457 Log .debug (self , "Nginx already installed" )
0 commit comments