Browse Source

Fixed Nginx configuration bug

bugfixes
gau1991 10 years ago
parent
commit
0b28056222
  1. 212
      ee/cli/plugins/stack.py
  2. 1
      ee/core/aptget.py

212
ee/cli/plugins/stack.py

@ -141,111 +141,113 @@ class EEStackController(CementBaseController):
if set(EEVariables.ee_postfix).issubset(set(apt_packages)): if set(EEVariables.ee_postfix).issubset(set(apt_packages)):
pass pass
if set(EEVariables.ee_nginx).issubset(set(apt_packages)): if set(EEVariables.ee_nginx).issubset(set(apt_packages)):
# Nginx core configuration change using configparser if ((not os.path.isfile('/etc/nginx/conf.d/ee-nginx.conf')) and
nc = NginxConfig() os.path.isfile('/etc/nginx/nginx.conf')):
self.app.log.debug('Loading file /etc/nginx/nginx.conf ') nc = NginxConfig()
nc.loadf('/etc/nginx/nginx.conf') self.app.log.debug('Loading file /etc/nginx/nginx.conf ')
nc.set('worker_processes', 'auto') nc.loadf('/etc/nginx/nginx.conf')
nc.append(('worker_rlimit_nofile', '100000'), position=2) nc.set('worker_processes', 'auto')
nc.remove(('events', '')) nc.append(('worker_rlimit_nofile', '100000'), position=2)
nc.append({'name': 'events', 'param': '', 'value': nc.remove(('events', ''))
[('worker_connections', '4096'), nc.append({'name': 'events', 'param': '', 'value':
('multi_accept', 'on')]}, position=4) [('worker_connections', '4096'),
nc.set([('http',), 'keepalive_timeout'], '30') ('multi_accept', 'on')]}, position=4)
self.app.log.debug("Writting nginx configration to " nc.set([('http',), 'keepalive_timeout'], '30')
"file /etc/nginx/nginx.conf ") self.app.log.debug("Writting nginx configration to "
nc.savef('/etc/nginx/nginx.conf') "file /etc/nginx/nginx.conf ")
nc.savef('/etc/nginx/nginx.conf')
# Custom Nginx configuration by EasyEngine
data = dict(version='EasyEngine 3.0.1') # Custom Nginx configuration by EasyEngine
self.app.log.debug('writting the nginx configration to file' data = dict(version='EasyEngine 3.0.1')
'/etc/nginx/conf.d/ee-nginx.conf ') self.app.log.debug('writting the nginx configration to '
ee_nginx = open('/etc/nginx/conf.d/ee-nginx.conf', 'w') 'file /etc/nginx/conf.d/ee-nginx.conf ')
self.app.render((data), 'nginx-core.mustache', out=ee_nginx) ee_nginx = open('/etc/nginx/conf.d/ee-nginx.conf', 'w')
ee_nginx.close() self.app.render((data), 'nginx-core.mustache',
out=ee_nginx)
data = dict() ee_nginx.close()
self.app.log.debug('writting the nginx configration to file'
'/etc/nginx/conf.d/blockips.conf ') data = dict()
ee_nginx = open('/etc/nginx/conf.d/blockips.conf', 'w') self.app.log.debug('writting the nginx configration to'
self.app.render((data), 'blockips.mustache', out=ee_nginx) 'file /etc/nginx/conf.d/blockips.conf')
ee_nginx.close() ee_nginx = open('/etc/nginx/conf.d/blockips.conf', 'w')
self.app.render((data), 'blockips.mustache', out=ee_nginx)
self.app.log.debug('writting the nginx configration to file' ee_nginx.close()
'/etc/nginx/conf.d/fastcgi.conf ')
ee_nginx = open('/etc/nginx/conf.d/fastcgi.conf', 'w') self.app.log.debug('writting the nginx configration to'
self.app.render((data), 'fastcgi.mustache', out=ee_nginx) ' file /etc/nginx/conf.d/fastcgi.conf')
ee_nginx.close() ee_nginx = open('/etc/nginx/conf.d/fastcgi.conf', 'w')
self.app.render((data), 'fastcgi.mustache', out=ee_nginx)
data = dict(php="9000", debug="9001") ee_nginx.close()
self.app.log.debug('writting the nginx configration to file'
'/etc/nginx/conf.d/upstream.conf ') data = dict(php="9000", debug="9001")
ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w') self.app.log.debug('writting the nginx configration to'
self.app.render((data), 'upstream.mustache', out=ee_nginx) 'file /etc/nginx/conf.d/upstream.conf ')
ee_nginx.close() ee_nginx = open('/etc/nginx/conf.d/upstream.conf', 'w')
self.app.render((data), 'upstream.mustache', out=ee_nginx)
# Setup Nginx common directory ee_nginx.close()
if not os.path.exists('/etc/nginx/common'):
self.app.log.debug('Creating directory' # Setup Nginx common directory
'/etc/nginx/common') if not os.path.exists('/etc/nginx/common'):
os.makedirs('/etc/nginx/common') self.app.log.debug('Creating directory'
'/etc/nginx/common')
data = dict() os.makedirs('/etc/nginx/common')
self.app.log.debug('Writting the nginx configration to'
'file /etc/nginx/common/acl.conf') data = dict()
ee_nginx = open('/etc/nginx/common/acl.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'acl.mustache', 'file /etc/nginx/common/acl.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/acl.conf', 'w')
ee_nginx.close() self.app.render((data), 'acl.mustache',
out=ee_nginx)
self.app.log.debug('Writting the nginx configration to' ee_nginx.close()
'file /etc/nginx/common/locations.conf')
ee_nginx = open('/etc/nginx/common/locations.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'locations.mustache', 'file /etc/nginx/common/locations.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/locations.conf', 'w')
ee_nginx.close() self.app.render((data), 'locations.mustache',
out=ee_nginx)
self.app.log.debug('Writting the nginx configration to' ee_nginx.close()
'file /etc/nginx/common/ php.conf')
ee_nginx = open('/etc/nginx/common/php.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'php.mustache', 'file /etc/nginx/common/ php.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/php.conf', 'w')
ee_nginx.close() self.app.render((data), 'php.mustache',
out=ee_nginx)
self.app.log.debug('Writting the nginx configration to' ee_nginx.close()
'file /etc/nginx/common/w3tc.conf')
ee_nginx = open('/etc/nginx/common/w3tc.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'w3tc.mustache', 'file /etc/nginx/common/w3tc.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/w3tc.conf', 'w')
ee_nginx.close() self.app.render((data), 'w3tc.mustache',
out=ee_nginx)
self.app.log.debug('Writting the nginx configration to' ee_nginx.close()
'file /etc/nginx/common/wpcommon.conf')
ee_nginx = open('/etc/nginx/common/wpcommon.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'wpcommon.mustache', 'file /etc/nginx/common/wpcommon.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/wpcommon.conf', 'w')
ee_nginx.close() self.app.render((data), 'wpcommon.mustache',
out=ee_nginx)
self.app.log.debug('Writting the nginx configration to' ee_nginx.close()
'file /etc/nginx/common/wpfc.conf')
ee_nginx = open('/etc/nginx/common/wpfc.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'wpfc.mustache', 'file /etc/nginx/common/wpfc.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/wpfc.conf', 'w')
ee_nginx.close() self.app.render((data), 'wpfc.mustache',
out=ee_nginx)
self.app.log.debug('Writting the nginx configration to' ee_nginx.close()
'file /etc/nginx/common/wpsc.conf')
ee_nginx = open('/etc/nginx/common/wpsc.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'wpsc.mustache', 'file /etc/nginx/common/wpsc.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/wpsc.conf', 'w')
ee_nginx.close() self.app.render((data), 'wpsc.mustache',
out=ee_nginx)
self.app.log.debug('Writting the nginx configration to' ee_nginx.close()
'file /etc/nginx/common/wpsubdir.conf')
ee_nginx = open('/etc/nginx/common/wpsubdir.conf', 'w') self.app.log.debug('Writting the nginx configration to'
self.app.render((data), 'wpsubdir.mustache', 'file /etc/nginx/common/wpsubdir.conf')
out=ee_nginx) ee_nginx = open('/etc/nginx/common/wpsubdir.conf', 'w')
ee_nginx.close() self.app.render((data), 'wpsubdir.mustache',
out=ee_nginx)
ee_nginx.close()
if set(EEVariables.ee_php).issubset(set(apt_packages)): if set(EEVariables.ee_php).issubset(set(apt_packages)):
# Parse etc/php5/fpm/php.ini # Parse etc/php5/fpm/php.ini

1
ee/core/aptget.py

@ -126,7 +126,6 @@ class EEAptGet():
def __dependencies_loop(cache, deplist, pkg, onelevel=True): def __dependencies_loop(cache, deplist, pkg, onelevel=True):
""" Loops through pkg's dependencies. """ Loops through pkg's dependencies.
Returns a list with every package found. """ Returns a list with every package found. """
print("Inside")
if onelevel: if onelevel:
onelevellist = [] onelevellist = []
if not pkg.is_installed: if not pkg.is_installed:

Loading…
Cancel
Save