-
Notifications
You must be signed in to change notification settings - Fork 0
/
autoindex.sh
27 lines (23 loc) · 1.25 KB
/
autoindex.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# **************************************************************************** #
# #
# ::: :::::::: #
# autoindex.sh :+: :+: :+: #
# +:+ +:+ +:+ #
# By: apuchill <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2020/07/09 11:33:59 by apuchill #+# #+# #
# Updated: 2020/07/12 17:42:15 by apuchill ### ########.fr #
# #
# **************************************************************************** #
#!/bin/bash
# This script turns autoindex on or off according to argument $1
INDEX=$1
NGINX_CONF=/etc/nginx/sites-available/nginx.conf
if [[ "$INDEX" == "on" || "$INDEX" == "off" ]];
then
sed -i -E "/autoindex/ s/on|off/$INDEX/" $NGINX_CONF
nginx -s reload
echo "Autoindex option is now set to $INDEX"
else
echo "Please provide a valid value ('on' or 'off') for autoindex"
fi