Skip to content

Commit 74be238

Browse files
author
gau1991
committed
Delayed HHVM nginx config
1 parent f788537 commit 74be238

File tree

3 files changed

+22
-46
lines changed

3 files changed

+22
-46
lines changed

ee/cli/plugins/debug.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,15 @@ def debug_php(self):
171171
"{/,/}/p \" /etc/nginx/"
172172
"conf.d/upstream.conf "
173173
"| grep 9001")):
174+
174175
Log.info(self, "Enabling PHP debug")
175-
data = dict(php="9001", debug="9001", hhvm="9001")
176+
# Check HHVM is installed if not instlled then dont not enable
177+
# it in upstream config
178+
if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"):
179+
hhvmconf=True
180+
else:
181+
hhvmconf=False
182+
data = dict(php="9001", debug="9001", hhvm="9001", hhvmconf)
176183
Log.debug(self, 'Writting the Nginx debug configration to file'
177184
' /etc/nginx/conf.d/upstream.conf ')
178185
ee_nginx = open('/etc/nginx/conf.d/upstream.conf',
@@ -209,6 +216,15 @@ def debug_php(self):
209216
"/etc/nginx/conf.d/upstream.conf "
210217
"| grep 9001"):
211218
Log.info(self, "Disabling PHP debug")
219+
220+
# Check HHVM is installed if not instlled then dont not enable
221+
# it in upstream config
222+
if os.path.isfile("/etc/nginx/common/wpfc-hhvm.conf"):
223+
hhvmconf=True
224+
else:
225+
hhvmconf=False
226+
data = dict(php="9001", debug="9001", hhvm="9001", hhvmconf)
227+
212228
data = dict(php="9000", debug="9001", hhvm="8000")
213229
Log.debug(self, 'Writting the Nginx debug configration to file'
214230
' /etc/nginx/conf.d/upstream.conf ')

ee/cli/plugins/stack.py

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,10 @@ def post_pref(self, apt_packages, packages):
227227
self.app.render((data), 'fastcgi.mustache', out=ee_nginx)
228228
ee_nginx.close()
229229

230-
data = dict(php="9000", debug="9001", hhvm="8000")
230+
data = dict(php="9000", debug="9001", hhvm="8000",
231+
hhvmconf=False)
231232
Log.debug(self, 'Writting the nginx configuration to '
232-
'file /etc/nginx/conf.d/upstream.conf ')
233+
'file /etc/nginx/conf.d/upstream.conf')
233234
ee_nginx = open('/etc/nginx/conf.d/upstream.conf',
234235
encoding='utf-8', mode='w')
235236
self.app.render((data), 'upstream.mustache', out=ee_nginx)
@@ -258,38 +259,6 @@ def post_pref(self, apt_packages, packages):
258259
out=ee_nginx)
259260
ee_nginx.close()
260261

261-
Log.debug(self, 'Writting the nginx configuration to '
262-
'file /etc/nginx/common/php-hhvm.conf')
263-
ee_nginx = open('/etc/nginx/common/php-hhvm.conf',
264-
encoding='utf-8', mode='w')
265-
self.app.render((data), 'php-hhvm.mustache',
266-
out=ee_nginx)
267-
ee_nginx.close()
268-
269-
Log.debug(self, 'Writting the nginx configuration to '
270-
'file /etc/nginx/common/w3tc-hhvm.conf')
271-
ee_nginx = open('/etc/nginx/common/w3tc-hhvm.conf',
272-
encoding='utf-8', mode='w')
273-
self.app.render((data), 'w3tc-hhvm.mustache',
274-
out=ee_nginx)
275-
ee_nginx.close()
276-
277-
Log.debug(self, 'Writting the nginx configuration to '
278-
'file /etc/nginx/common/wpfc-hhvm.conf')
279-
ee_nginx = open('/etc/nginx/common/wpfc-hhvm.conf',
280-
encoding='utf-8', mode='w')
281-
self.app.render((data), 'wpfc-hhvm.mustache',
282-
out=ee_nginx)
283-
ee_nginx.close()
284-
285-
Log.debug(self, 'Writting the nginx configuration to '
286-
'file /etc/nginx/common/wpsc-hhvm.conf')
287-
ee_nginx = open('/etc/nginx/common/wpsc-hhvm.conf',
288-
encoding='utf-8', mode='w')
289-
self.app.render((data), 'wpsc-hhvm.mustache',
290-
out=ee_nginx)
291-
ee_nginx.close()
292-
293262
Log.debug(self, 'Writting the nginx configuration to '
294263
'file /etc/nginx/common/php.conf')
295264
ee_nginx = open('/etc/nginx/common/php.conf',
@@ -338,17 +307,6 @@ def post_pref(self, apt_packages, packages):
338307
out=ee_nginx)
339308
ee_nginx.close()
340309

341-
# Fix whitescreen of death beacuse of missing value
342-
# fastcgi_param SCRIPT_FILENAME $request_filename; in file
343-
# /etc/nginx/fastcgi_params
344-
345-
if not EEFileUtils.grep(self, '/etc/nginx/fastcgi_params',
346-
'SCRIPT_FILENAME'):
347-
with open('/etc/nginx/fastcgi_params',
348-
encoding='utf-8', mode='a') as ee_nginx:
349-
ee_nginx.write('fastcgi_param \tSCRIPT_FILENAME '
350-
'\t$request_filename;\n')
351-
352310
# Pagespeed configuration
353311
Log.debug(self, 'Writting the Pagespeed Global '
354312
'configuration to file /etc/nginx/conf.d/'

ee/cli/templates/upstream.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ upstream debug {
77
# Debug Pool
88
server 127.0.0.1:{{debug}};
99
}
10+
{{#hhvmconf}}
1011
upstream hhvm {
1112
# HHVM Pool
1213
server 127.0.0.1:{{hhvm}};
1314
server 127.0.0.1:{{php}} backup;
1415
}
16+
{{/hhvmconf}}

0 commit comments

Comments
 (0)