@@ -15,6 +15,7 @@ OwnError()
1515EEUPDATE ()
1616{
1717 # Clone EasyEngine (ee) Stable Repository
18+ rm -rf /tmp/easyengine
1819 git clone -b stable git://github.com/rtCamp/easyengine.git /tmp/easyengine & >> $INSTALLLOG || OwnError " Unable To Clone Easy Engine"
1920
2021 # EasyEngine (ee) /etc Files
@@ -83,13 +84,54 @@ EEUPDATE()
8384 fi
8485}
8586
87+ HTTPAUTH ()
88+ {
89+ # Get The htpasswd Details
90+ HTPASSWDUSER=$( grep htpasswduser /etc/easyengine/ee.conf | awk ' {print($3)}' )
91+ HTPASSWDPASS=$( grep htpasswdpass /etc/easyengine/ee.conf | awk ' {print($3)}' )
92+
93+ # Ask User To Provide HTTP AUTH Username & Password
94+ if [ -z " $HTPASSWDUSER " ]
95+ then
96+ read -p " Enter The HTTP AUTH Username [easyengine]: " HTPASSWDUSER
97+ # Turn Off Echo For Passwords
98+ stty -echo
99+ read -p " Enter The HTTP AUTH Password [easyengine]: " HTPASSWDPASS
100+ stty echo
101+ echo
102+ fi
103+
104+ # If Enter Is Pressed, User Defaults
105+ if [[ $HTPASSWDUSER = " " ]]
106+ then
107+ HTPASSWDUSER=easyengine
108+ fi
109+
110+ if [[ $HTPASSWDPASS = " " ]]
111+ then
112+ HTPASSWDPASS=easyengine
113+ fi
114+
115+ # Add HTTP Auth Details In EE Configuration File
116+ sed -i " s/htpasswduser.*/htpasswduser = $HTPASSWDUSER /" /etc/easyengine/ee.conf
117+ sed -i " s/htpasswdpass.*/htpasswdpass = $HTPASSWDPASS /" /etc/easyengine/ee.conf
118+
119+ # Generate htpasswd-ee file
120+ printf " $HTPASSWDUSER :$( openssl passwd -crypt $HTPASSWDPASS 2> /dev/null) \n" > /etc/nginx/htpasswd-ee 2> /dev/null
121+ }
86122
87123EE101 ()
88124{
89125 # Let Copy Some Missing Files
90126 (sed " /allow/,+2d" /usr/share/easyengine/nginx/common/acl.conf; grep -v ^# /etc/nginx/common/allowed_ip.conf ) > /etc/nginx/common/acl.conf
91127 cp -v /usr/share/easyengine/nginx/common/locations.conf /etc/nginx/common
92-
128+ sed -i " s/fastcgi_cache_use_stale.*/fastcgi_cache_use_stale error timeout invalid_header updating http_500 http_503;\nfastcgi_cache_valid any 1h;/g" /etc/nginx/conf.d/fastcgi.conf
129+ sed -i " /client_max_body_size/a \ \n\t# SSL Settings\n\tssl_session_cache shared:SSL:20m;\n\tssl_session_timeout 10m;\n\tssl_prefer_server_ciphers on;\n\tssl_ciphers HIGH:\!aNULL:\!MD5:\!kEDH;\n\n" /etc/nginx/nginx.conf
130+ sed -i " s/log_format rt_cache.*/log_format rt_cache '\$ remote_addr \$ upstream_response_time \$ upstream_cache_status [\$ time_local] '/" /etc/nginx/nginx.conf
131+ sed -i " s/.*\$ body_bytes_sent'/\t\t'\$ http_host \"\$ request\" \$ status \$ body_bytes_sent '/" /etc/nginx/nginx.conf
132+
133+ # Move PHP’s Session Storage To Memcache
134+ sed -i " /extension/a \session.save_handler = memcache\nsession.save_path = \" tcp://localhost:11211\" " /etc/php5/mods-available/memcache.ini
93135}
94136
95137
@@ -114,13 +156,20 @@ then
114156
115157 # Update EasyEngine (ee)
116158 EEUPDATE
159+ HTTPAUTH
117160
118161 if [[ $EECURRENTVERSION = 1.0.1 ]]
119162 then
120163 EE101
121164 fi
122165 fi
123166
167+ # Source EasyEngine (ee) Auto Complete To Take Effect
168+ echo
169+ echo -e " \033[34mFor EasyEngine (ee) Auto Completion Run Following Command\e[0m" | tee -ai $INSTALLLOG
170+ echo -e " \033[37msource /etc/bash_completion.d/ee\e[0m" | tee -ai $INSTALLLOG
171+ echo
172+
124173else
125174 echo " EasyEngine Already Updated To The Latest Version"
126175fi
0 commit comments