2022-05-22 14:31:07
第一步:找到nginx.conf 编辑 加
#自己搞得 php cache fastcgi_cache_path /nginxcache levels=1:2 keys_zone=MY_CACHE:100m inactive=60m; fastcgi_cache_key "$scheme$request_method$host$request_uri"; |
第二部找到自己网站下的http 添加
fastcgi_cache MY_CACHE; fastcgi_cache_valid 200 60m; add_header X-Cache $upstream_cache_status; |
一个完整的示例
原始
server { listen 80; server_name www.xx.com; root "D:/web/xx.com/www"; error_page 404 "/404.html"; include "D:/hws.com/Nginx/nginx_conf/rewrite/www.zaiyi023.com.conf"; location / { index index.html index.htm index.php default.php start.html; } location ~ .php(.*)$ { fastcgi_pass 127.0.0.1:18158; fastcgi_index index.html; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_split_path_info ^(.+.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; } } |
后来
server { listen 80; server_name www.xx.com; root "D:/web/xx.com/www"; error_page 404 "/404.html"; include "D:/hws.com/Nginx/nginx_conf/rewrite/www.zaiyi023.com.conf"; location / { index index.html index.htm index.php default.php start.html; } location ~ .php(.*)$ { fastcgi_cache MY_CACHE; fastcgi_cache_valid 200 60m; add_header X-Cache $upstream_cache_status; fastcgi_pass 127.0.0.1:18158; fastcgi_index index.html; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_split_path_info ^(.+.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; } } |
原文链接:https://www.yuepc.com/info/153064.html
技术文章 2024-01-03
技术文章 2024-01-03
技术文章 2024-01-03
技术文章 2023-09-24
技术文章 2023-09-21
技术文章 2023-09-17
技术文章 2023-09-17
技术文章 2023-09-13
技术文章 2023-09-13
技术文章 2023-09-10