Fix install_nginx.sh.

This commit is contained in:
BoHung Chiu 2023-09-27 21:54:09 +08:00
parent 03d88af847
commit 240729cca6
1 changed files with 2 additions and 2 deletions

View File

@ -12,6 +12,7 @@ if [[ -z "$(which git)" ]]; then
sudo apt-get install -y git
fi
sudo apt-get install -y linux-kernel-headers software-properties-common build-essential
sudo apt-get install -y libxslt-dev libgd-dev
org_pwd="$(pwd)"
cpu_cores="$(nproc --all)"
if [[ -z "$cpu_cores" ]]; then
@ -195,16 +196,15 @@ if [[ "$nginx_ver" < $nginx_target_ver ]] || [[ "$1" == '--force' ]] || [[ "$ins
mkdir -p /etc/nginx/modules && \
if [ ! -e /usr/share/nginx/modules ]; then ln -s /etc/nginx/modules /usr/share/nginx/modules; fi && \
rm -f /usr/sbin/nginx && \
mkdir -p /etc/nginx/modules-enabled && \
ln -s /usr/share/nginx/sbin/nginx /usr/sbin/. && $extra_build_nginx_cmd && \
mkdir -p /var/lib/nginx && \
mkdir -p /etc/nginx/modules-enabled && \
service nginx restart"
if [[ "$install_modsecurity" == "1" ]]; then
sudo bash -l -c "
cd /root/nginx-$nginx_target_ver && \
make modules && \
cp -f objs/ngx_http_modsecurity_module.so /etc/nginx/modules/. && \
mkdir -p /etc/nginx/modules-enabled && \
echo 'load_module modules/ngx_http_modsecurity_module.so;' > /etc/nginx/modules-enabled/50-mod-modsecurity.conf && \
mkdir -p /etc/nginx/modsec && \
wget -P /etc/nginx/modsec/ https://raw.githubusercontent.com/SpiderLabs/ModSecurity/v3/master/modsecurity.conf-recommended && \