Discuz站点,前端自建nginx CDN节点,遇到问题是登录等操作后页面不会立即生效,比如登录提示成功后到首页显示未登录,按F5刷新后才显示登录的用户信息。
nginx配置如下
- proxy_cache_path /home/wwwroot/bbs.Discuz.net levels=1:2 keys_zone=Discuz:50m inactive=30m max_size=50m;
- server {
- listen 80;
- server_name bbs.Discuz.net;
- access_log off;
- #charset utf-8,gbk;
- if ($request_uri ~ ^/(index.html|login|register|password|/reset)) {
- set $cookie_nocache 1;
- }
- location / {
- proxy_set_header Accept-Encoding "";
- proxy_pass http://bbs.Discuz.net;
- proxy_redirect off;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_cache Discuz;
- proxy_cache_key $host$uri$is_args$args;
- proxy_no_cache $cookie_nocache $arg_nocache $arg_comment;
- proxy_no_cache $http_pragma $http_authorization;
- add_header Nginx-Cache "$upstream_cache_status";
- proxy_cache_valid 200 304 30m;
- proxy_cache_valid 301 24h;
- proxy_cache_valid 500 502 503 504 0s;
- proxy_cache_valid any 1s;
- proxy_cache_min_uses 1;
- expires 12h;
- }
-
- }
复制代码
大神来帮忙优化一下nginx配置 |