nginx config fix
This commit is contained in:
parent
738ef88259
commit
ad2904619d
1 changed files with 3 additions and 3 deletions
|
@ -8,19 +8,19 @@ fi
|
|||
|
||||
# Install requirements
|
||||
echo "Installing required packages..."
|
||||
apt-get install -y nginx-extras
|
||||
apt-get install -y nginx-extras nginx-module-njs
|
||||
|
||||
# Add load_module directive to nginx.conf if not present
|
||||
echo "Adding load_module directive to nginx.conf if needed..."
|
||||
if ! grep -q "^load_module.*ngx_http_js_module.so" /etc/nginx/nginx.conf; then
|
||||
# Create temporary file
|
||||
sed '/^events {/i load_module modules/ngx_http_js_module.so;' /etc/nginx/nginx.conf > /tmp/nginx.conf.tmp
|
||||
sed '/^events {/i load_module /usr/lib/nginx/modules/ngx_http_js_module.so;' /etc/nginx/nginx.conf > /tmp/nginx.conf.tmp
|
||||
# Check if the modification was successful
|
||||
if nginx -t -c /tmp/nginx.conf.tmp; then
|
||||
mv /tmp/nginx.conf.tmp /etc/nginx/nginx.conf
|
||||
else
|
||||
rm /tmp/nginx.conf.tmp
|
||||
echo "Failed to modify nginx.conf safely. Please add 'load_module modules/ngx_http_js_module.so;' manually."
|
||||
echo "Failed to modify nginx.conf safely. Please add 'load_module /usr/lib/nginx/modules/ngx_http_js_module.so;' manually."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue