mirror of
https://github.com/myvesta/vesta
synced 2025-08-19 21:04:07 -07:00
Introducing v-change-vesta-port
This commit is contained in:
parent
8b39d8e847
commit
6343b3e20d
3 changed files with 49 additions and 0 deletions
0
bin/v-add-letsencrypt-user
Normal file → Executable file
0
bin/v-add-letsencrypt-user
Normal file → Executable file
49
bin/v-change-vesta-port
Executable file
49
bin/v-change-vesta-port
Executable file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# info: change vesta port
|
||||||
|
# options: port
|
||||||
|
#
|
||||||
|
# Function change vesta port
|
||||||
|
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Variable&Function #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
whoami=$(whoami)
|
||||||
|
if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then
|
||||||
|
echo "You must be root or admin to execute this script";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Argument definition
|
||||||
|
port=$1
|
||||||
|
|
||||||
|
re='^[0-9]+$'
|
||||||
|
if ! [[ $port =~ $re ]] ; then
|
||||||
|
echo "error: Not a number" >&2; exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$VESTA/conf/port.conf" ]; then
|
||||||
|
oldport=8083
|
||||||
|
else
|
||||||
|
oldport=`cat $VESTA/conf/port.conf`
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i "s|$oldport;|$port;|g" /usr/local/vesta/nginx/conf/nginx.conf
|
||||||
|
sed -i "s|'$oldport'|'$port'|g" /etc/roundcube/plugins/password/config.inc.php
|
||||||
|
sed -i "s|'$oldport'|'$port'|g" /usr/local/vesta/data/firewall/rules.conf
|
||||||
|
$VESTA/bin/v-update-firewall
|
||||||
|
systemctl restart fail2ban.service
|
||||||
|
systemctl restart vesta
|
||||||
|
|
||||||
|
echo "$port" > $VESTA/conf/port.conf
|
||||||
|
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
# Vesta #
|
||||||
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
log_event "$OK" "$ARGUMENTS"
|
||||||
|
|
||||||
|
exit 0;
|
0
bin/v-list-sys-config
Normal file → Executable file
0
bin/v-list-sys-config
Normal file → Executable file
Loading…
Add table
Add a link
Reference in a new issue