def setting_trans_env(server_name):
conf_name = 'download_{}.conf'.format(server_name)
root_dir = '/app/opbak/download_{}_{}'.format(TIMESTAMP, server_name)
mk_remote_dir(root_dir)
try:
with cd('/app/nginx/conf/vhost'):
run('''echo -e "server {\\n listen 80;\\n server_name %s;\\n root %s;\\n index Main.html;\\n access_log logs/default.access.log main;\\n location / {\\n expires 0;\\n }\\n\\n error_page 404 500 502 503 504 /404.html;\\n}" >%s''' % (server_name, root_dir, conf_name))
reload_nginx()
yield
finally:
with cd('/app/nginx/conf/vhost'):
run('rm -f {}'.format(conf_name))
reload_nginx()
run('rm -rf {}'.format(root_dir))
评论列表
文章目录