Fixes in proxy virtualhost

This commit is contained in:
absurdo 2023-12-14 23:51:40 +01:00
parent b2b879c3f8
commit d3d041f569
9 changed files with 84 additions and 21 deletions

View file

@ -182,16 +182,16 @@ if args.path!='/':
</Location> \n\
".format(args.path[:-1], home_user, home_user, args.path[:-1])
base_name_file='{}-002-{}.conf'.format(args.domain, os.path.basename(args.path[1:-1]))
base_name_file='{}-{}.conf'.format(args.domain, os.path.basename(args.path[1:-1]))
name_file='/home/{}/{}-002-{}.conf'.format(system_user, args.domain, os.path.basename(args.path[1:-1]))
name_file='/home/{}/{}-{}.conf'.format(system_user, args.domain, os.path.basename(args.path[1:-1]))
with open(name_file, 'w') as f:
f.write(alias_apache)
print('Updating apache configuration for wordpress outside of htdocs...\n')
if subprocess.call('sudo mv {} /etc/{}/vhosts.d/extra && sudo chown root:root /etc/{}/vhosts.d/extra/{}'.format(name_file, apache_cmd, apache_cmd, base_name_file), shell=True) > 0:
if subprocess.call('sudo mv {} /etc/{}/vhosts.d/extra/proxyphp && sudo chown root:root /etc/{}/vhosts.d/extra/proxyphp/{}'.format(name_file, apache_cmd, apache_cmd, base_name_file), shell=True) > 0:
print('Error')
sys.exit(1)
@ -200,7 +200,7 @@ if args.path!='/':
print('Restarting apache...')
if subprocess.call('sudo '+apachectl+' configtest && sudo systemctl restart '+apache_cmd, shell=True) > 0:
subprocess.call('sudo rm /etc/{}/vhosts.d/extra/{}'.format(apache_cmd, base_name_file), shell=True)
subprocess.call('sudo rm /etc/{}/vhosts.d/extra/proxyphp/{}'.format(apache_cmd, base_name_file), shell=True)
print('Error: Error in configtest\n')
sys.exit(1)