Linux 从bash脚本安装nginx模块不需要';行不通
我使用Nginx v16.1.1,我想安装modsecurity 如果我从命令行运行下面列出的命令,ModSecurity模块将作为已安装的模块出现在“nginx-V”中 但是,如果我以文件(例如../myscript.sh)的形式执行脚本,它不会按预期安装模块Linux 从bash脚本安装nginx模块不需要';行不通,linux,bash,nginx,Linux,Bash,Nginx,我使用Nginx v16.1.1,我想安装modsecurity 如果我从命令行运行下面列出的命令,ModSecurity模块将作为已安装的模块出现在“nginx-V”中 但是,如果我以文件(例如../myscript.sh)的形式执行脚本,它不会按预期安装模块 #!/bin/sh # Download and Install libModSecurity cd /opt/ git clone https://github.com/SpiderLabs/ModSecurity cd ModSe
#!/bin/sh
# Download and Install libModSecurity
cd /opt/
git clone https://github.com/SpiderLabs/ModSecurity
cd ModSecurity
git checkout v3/master
sh build.sh
git submodule init
git submodule update
./configure
# Build libModSecurity
make && make install
make check
# Download the ModSecurity Nginx connector
cd /opt/
git clone https://github.com/SpiderLabs/ModSecurity-nginx.git
#########
# Nginx #
#########
echo "Installing Nginx..."
# Download latest stable version
NGINX_VER='nginx-1.16.1'
cd /opt/
echo "Downloading $NGINX_VER..."
wget http://nginx.org/download/$NGINX_VER.tar.gz
tar xvzf $NGINX_VER.tar.gz
cd $NGINX_VER
./configure --prefix=/usr/share/nginx \
--with-debug \
--add-module=/opt/ModSecurity-nginx \
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
--with-ld-opt=' -Wl,-E'
# Install
make && make install
# Check installed modules
nginx -V
有什么想法吗?在
/configure
之后的
将阻止--将debug
作为命令读取,这可能是导致此问题的原因(如果您有必要的权限)
“将脚本作为脚本运行”是什么意思?这与“手动运行脚本”有何区别?@tripleee edited如果您以前安装了
nginx
,则脚本中的nginx
可能运行您最初安装的脚本。在这两种情况下,输入nginx
输出什么?
./configure \
--with-debug \
--add-module=/opt/ModSecurity-nginx \
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' \
--with-ld-opt=' -Wl,-E'