Skip to content

Commit 4baf5eb

Browse files
authored
Get vesta port by reading nginx.conf
1 parent 8d85cdc commit 4baf5eb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bin/v-add-firewall-chain

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ protocol=$(echo $protocol|tr '[:lower:]' '[:upper:]')
2121
# Defining absolute path to iptables
2222
iptables="/sbin/iptables"
2323

24+
# Get vesta port by reading nginx.conf
25+
vestaport=$(grep 'listen' /usr/local/vesta/nginx/conf/nginx.conf | awk '{print $2}' | sed "s|;||")
26+
if [ -z "$vestaport" ]; then
27+
vestaport=8083
28+
fi
29+
2430
# Includes
2531
source $VESTA/func/main.sh
2632
source $VESTA/conf/vesta.conf
@@ -47,7 +53,7 @@ case $chain in
4753
DNS) port=53; protocol=UDP ;;
4854
WEB) port='80,443'; protocol=TCP ;;
4955
DB) port='3306,5432'; protocol=TCP ;;
50-
VESTA) port=8083; protocol=TCP ;;
56+
VESTA) port=$vestaport; protocol=TCP ;;
5157
*) check_args '2' "$#" 'CHAIN PORT' ;;
5258
esac
5359

0 commit comments

Comments
 (0)