到这里,OpenResty替换Nginx的工作就已经完成了。
vhost 参考配置文件
rewrite ^(.*)$ https://$host$1 permanent;
#listen [::]:443 ssl http2;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/inwao.com;
if ($request_method = POST) {
if ($query_string != "") {
if ($request_uri ~* "/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
set_unescape_uri $key $arg_key ;
redis2_query set $key $echo_request_body;
redis2_query expire $key 14400;
ssl_certificate /home/wwwroot/ssl/1.crt;
ssl_certificate_key /home/wwwroot/ssl/1.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers "TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5";
ssl_session_cache builtin:1000 shared:SSL:10m;
# openssl dhparam -out /usr/local/openresty/nginx/conf/ssl/dhparam.pem 2048
ssl_dhparam /usr/local/openresty/nginx/conf/ssl/dhparam.pem;
include rewrite/wordpress.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
# include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
location ~ .*\.(js|css)?$
location ~ /.well-known {
location ~ [^/]\.php(/|$) {
set $key "nginx-cache:$scheme$request_method$host$request_uri";
srcache_fetch_skip $skip_cache;
srcache_store_skip $skip_cache;
srcache_response_cache_control off;
set_escape_uri $escaped_key $key;
srcache_fetch GET /redis-fetch $key;
srcache_store PUT /redis-store key=$escaped_key;
more_set_headers 'X-Cache $srcache_fetch_status';
more_set_headers 'X-Store $srcache_store_status';
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_param PHP_VALUE "open_basedir=$document_root:/tmp/:/proc/";
}
修改好后重启openresty,去wordpress后台安装Nginx-Helper插件,开启redis缓存,其他全部默认即可。
这个插件的作用是能够及时的刷新缓存
命中情况可以在服务器上执行
最新评论
还好吧 我现在已经搞定了~ 还是喜欢typecho的轻量~
请问你的热门文章,后面是带访问量的,请问是怎样实现的?你提供的插件没有这功能。谢谢!
现在是美好的2021年。
纠结这个2天了 试试看~
我也是从WP→Te→Hexo这样折腾,最后感觉还是静态博客比较适合自己,以后不折腾了,Hexo真香
这一年都挺不容易了,以后会庆幸当时挺下来的自己,加油!
系统还不 错,需要跟稳定的