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