Nginx 安 module auth_request 失 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cnit
V2EX    NGINX

Nginx 安 module auth_request 失

  •  
  •   cnit 2022-06-24 15:14:33 +08:00 2119 次点击
    这是一个创建于 1212 天前的主题,其中的信息可能已经有所发展或是发生改变。
    [root@AliYun conf.d]# nginx -V nginx version: nginx/1.18.0 built by gcc 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC) built with OpenSSL 1.1.1k FIPS 25 Mar 2021 TLS SNI support enabled configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-http_auth_request_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' [root@AliYun conf.d]# nginx -V 2>&1 | grep -qF -- --with-http_auth_request_module && echo "Module Compiled" || echo "Not Compiled" Module Compiled [root@AliYun conf.d]# Jun 24 14:57:36 AliYun nginx[87531]: nginx: [emerg] unknown directive "auth_request" in /home/nginx/conf/conf.d/xxxx.conf:13 Jun 24 14:57:36 AliYun systemd[1]: nginx.service: Control process exited, code=exited status=1 Jun 24 14:57:36 AliYun systemd[1]: nginx.service: Failed with result 'exit-code'. Jun 24 14:57:36 AliYun systemd[1]: Failed to start Nginx proxy. 
    server { listen 80; listen 443 ssl; server_name xxxx; underscores_in_headers on; include /home/nginx/ssl/ssl.conf; location ~ ^/(demos|sig)/ { auth_request /console proxy_pass http://xxxxx$request_uri; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header X-Real-IP $remote_addr; } ... 

    指定 configure 参数之后,进行了 make && make install 折一天了 大佬帮忙看看吧

    14 条回复    2022-06-24 16:26:44 +08:00
    ryanbuu
        1
    ryanbuu  
       2022-06-24 15:25:10 +08:00
    你 /console 后边儿的分号呢……
    1point
        2
    1point  
       2022-06-24 15:29:09 +08:00
    我也感觉是没有;的问题
    cnit
        3
    cnit  
    OP
       2022-06-24 15:29:57 +08:00
    @q1angch0u 刚刚加上分号试了,问题依旧
    ryanbuu
        4
    ryanbuu  
       2022-06-24 15:32:21 +08:00
    @q1angch0u 虽然报错是找不到指令……
    ryanbuu
        5
    ryanbuu  
       2022-06-24 15:32:37 +08:00
    @cnit 你看看你编译的和要跑的是一个 bin 吗?
    cnit
        6
    cnit  
    OP
       2022-06-24 15:37:30 +08:00
    [root@AliYun conf.d]# ps -ef|grep nginx
    root 91899 1 0 15:29 ? 00:00:00 nginx: master process /home/nginx/sbin/
    nobody 91900 91899 0 15:29 ? 00:00:00 nginx: worker process
    nobody 91901 91899 0 15:29 ? 00:00:00 nginx: worker process
    nobody 91902 91899 0 15:29 ? 00:00:00 nginx: worker process
    nobody 91903 91899 0 15:29 ? 00:00:00 nginx: worker process
    nobody 91904 91899 0 15:29 ? 00:00:00 nginx: cache manager process
    root 92464 4155721 0 15:36 pts/0 00:00:00 grep --color=auto nginx
    root 4168638 4155721 0 11:44 pts/0 00:00:00 vim nginx.conf
    [root@AliYun conf.d]# nginx -V
    nginx version: nginx/1.18.0
    built by gcc 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC)
    built with OpenSSL 1.1.1k FIPS 25 Mar 2021
    TLS SNI support enabled
    configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-


    是这个问题吗?
    cnit
        7
    cnit  
    OP
       2022-06-24 15:37:50 +08:00
    dier
        8
    dier  
       2022-06-24 15:45:15 +08:00
    我觉得应该是#5 说的问题,你这两个路径下都有 nginx ,如果不是做的链接,那说明安装了两个版本。
    ryanbuu
        9
    ryanbuu  
       2022-06-24 15:47:46 +08:00 via iPhone
    @cnit 你这不是一个 nginx 吧…备份替换下?
    cnit
        10
    cnit  
    OP
       2022-06-24 15:55:58 +08:00
    我备份了 /home/nginx 然后在其目录下指定了 configure 的路径为当前路径,在 make install 的时候
    install: build install_perl_modules
    test -d '$(DESTDIR)/home/nginx' || mkdir -p '$(DESTDIR)/home/nginx'

    test -d '$(DESTDIR)/home' \
    || mkdir -p '$(DESTDIR)/home'
    test ! -f '$(DESTDIR)/home/nginx/' \ 这里报错了
    || mv '$(DESTDIR)/home/nginx/' \
    '$(DESTDIR)/home/nginx/.old'
    cp objs/nginx '$(DESTDIR)/home/nginx/'

    sbin-path 指定如下:
    --sbin-path=/home/nginx/

    @q1angch0u
    cnit
        11
    cnit  
    OP
       2022-06-24 15:57:27 +08:00
    他为啥会给加个 $(DESTDIR) 呢
    cnit
        12
    cnit  
    OP
       2022-06-24 15:58:14 +08:00
    --prefix 是这个值
    ryanbuu
        13
    ryanbuu  
       2022-06-24 16:16:36 +08:00
    @cnit 不用那么麻烦啊……
    可以先不用移动,用`/usr/sbin/nginx -c <path_to_config> -t`看看配置文件有没有问题,如果没问题的话再`cp /home/nginx/sbin/nginx{,.bak} && cp /usr/sbin/nginx /home/nginx/sbin/nginx`
    cnit
        14
    cnit  
    OP
       2022-06-24 16:26:44 +08:00
    @q1angch0u 可以了!!! 谢谢
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2634 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    VERSION: 3.9.8.5 24ms UTC 14:42 PVG 22:42 LAX 07:42 JFK 10:42
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86