Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

phpbb with nginx and fcgi cache#947

Unanswered
basti122303 asked this question inQ&A
Discussion options

Hello,
Is anyone using phpbb with nginx and fcgi cache?

I'm trying to implement this for non-logged-in users, but the cache is either not being used or is always missed.

Even when I access the same page/article multiple times.

Can someone please help?

Configuration attached:

# configuration file /etc/nginx/conf.d/10-phpbb-cache.conf:fastcgi_cache_path /var/cache/nginx/phpbb levels=1:2 keys_zone=phpbb_cache:20m                     max_size=1g inactive=60m use_temp_path=off;# phpBB sets two cookies by default:# phpbb3_<hash>_sid → session ID (exists for all visitors, even guests)# phpbb3_<hash>_u → user ID (1 for guests, other values for logged-in users)# nginx regex engine doesn’t handle negative lookahead (?!1) reliably inside if condition# extract numeric user id from phpbb cookie; default to 1 (guest)map $http_cookie $phpbb_user_id {    default 1;    ~*phpbb3_[a-z0-9]+_u=([0-9]+) $1;}# convert that to a boolean: 0 = guest (u=1), 1 = logged in (u != 1)map $phpbb_user_id $is_logged_in {    1      0;    default 1;}# server {} part  location / {        try_files $uri $uri/ @rewriteapp;      # Pass the php scripts to FastCGI server specified in upstream declaration.      location ~ \.php(/|$) {        include /etc/nginx/msportal/msportal_php_args;        try_files $uri $uri/ /app.php$is_args$args;      }      # Deny access to internal phpbb files.      location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?<!ext/)phpbb(?!\w+)|store|vendor) {        deny all;      }  }  location @rewriteapp {     rewrite ^(.*)$ /app.php/$1 last;  }  # Correctly pass scripts for installer  #location /install/ {  #   try_files $uri $uri/ @rewrite_installapp =404;  #   # Pass the php scripts to fastcgi server specified in upstream declaration.  #   location ~ \.php(/|$) {  #      include /etc/nginx/msportal/msportal_php_args;  #     try_files $uri $uri/ /install/app.php$is_args$args =404;  #   }  #}  location @rewrite_installapp {     rewrite ^(.*)$ /install/app.php/$1 last;  }  # Deny access to version control system directories.  location ~ /\.svn|/\.git {        deny all;  }  location ~* \.(?:css|js|jpe?g|png|gif|ico|woff2?|ttf|svg)$ {      expires   30d;  }  # apc und maintenance  location /_vacation-site {        auth_basic           "AdminOnly";        auth_basic_user_file /etc/nginx/htpasswd_msportal;        location ~ \.php$ {                fastcgi_param PHP_VALUE "upload_tmp_dir=/home/www/web1/tmp; session.save_path=/home/www/web1/tmp; open_basedir=/home/www/web1/html:/home/www/web1/tmp:/home/www/web1/files:/usr/share/php:/var/www; include_path=.:/var/www:/usr/share/php";                include /etc/nginx/msportal/php;        }  }}#fcgi settingsset $skip_cache 0;if ($request_method = POST) { set $skip_cache 1; }# if this line is active cache is always bypass#if ($query_string != "") { set $skip_cache 1; }# Skip cache for logged-in users (u != 1)# -- skip if logged in (uses map above) --if ($is_logged_in = 1) {    set $skip_cache 1;}if ($request_uri ~* "^/(adm|ucp)") { set $skip_cache 1; }  # optional: skip admin/user panelfastcgi_cache_key "$scheme$request_method$host$request_uri";fastcgi_cache phpbb_cache;fastcgi_cache_valid 200 301 302 30m;fastcgi_cache_use_stale error timeout invalid_header updating;fastcgi_cache_bypass $skip_cache;fastcgi_no_cache $skip_cache;add_header X-FastCGI-Cache $upstream_cache_status;
You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@basti122303

[8]ページ先頭

©2009-2025 Movatter.jp