0
다음과 같은 구성이 있습니다. 하지만 응용 프로그램에 액세스하면 로그인을 요구하지 않고 로그인 만합니다. 내가 뭘 잘못하고있어?Rails 응용 프로그램 용 Nginx로 바니시 (Devise 인증 관련 문제)
default.vcl
backend default {
.host = "127.0.0.1";
.port = "80";
}
sub vcl_recv {
if(req.url ~ "sign_in" || req.url ~ "sign_out" || req.request == "POST" || req.request == "PUT" || req.request == "DELETE") {
return (pass);
}
return (lookup);
}
sub vcl_fetch {
if(req.url ~ "logout" || req.url ~ "sign_out"){
unset beresp.http.Set-Cookie;
}
if (req.request == "GET") {
unset beresp.http.Set-Cookie;
set beresp.ttl = 360m;
}
if (req.url ~ "images/" || req.url ~ "javascripts" || req.url ~ "stylesheets" || req.url ~ "assets"){
set beresp.ttl = 360m;
}
}
은/etc/기본/니스
DAEMON_OPTS="-a 192.241.136.37:80 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
을/etc/nginx를/사이트 사용/기본
upstream app {
server unix:/tmp/unicorn.socket fail_timeout=0;
}
server {
listen 80;
client_max_body_size 2G;
server_name localhost;
keepalive_timeout 5;
root /home/deploy/apps/wms/current/public;
access_log off;
error_log off;
if ($request_method !~ ^(GET|HEAD|PUT|POST|DELETE|OPTIONS)$){
return 405;
}
location ~ ^/(assets)/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location/{
try_files $uri/index.html $uri.html $uri @app;
error_page 404 /404.html;
error_page 422 /422.html;
error_page 500 502 503 504 /500.html;
error_page 403 /403.html;
}
location @app {
proxy_pass http://app;
}
location = /favicon.ico {
expires max;
add_header Cache-Control public;
}
location ~ \.php$ {
deny all;
}
}
나는 니스에 새로 온 사람을 제외하고. 그 줄을 제거해야합니까? 어떻게해야합니까? –
첫 번째 if 블록을 제거/주석 처리하고 바니시를 다시로드/다시 시작하면 – NITEMAN
Worked라는 문제를 피할 수 있다고 확신합니다. 나는 두 개의 블록을 제거하고 그것은 매력처럼 작동했습니다. –