@aaPanel_Kern any advices to make the fastcgi cache works if wordpress is running in a subdirectory?
How to enable fastcgi cache for WordPress with aapanel
Josdansd
The same, except that the site data storage directory is different
aaPanel_Kern But I followed the same steps and I'm getting a 502 Nginx Error
Josdansd
It is recommended that you use Wordpress deploy for deployment and enable caching
- Edited
Tried so many times, when we use Fast CGI cache with NGINX helper security headers are not detected.
aaP_hareeshnarayan1982
Hello, it is recommended to modify the configuration and add it yourself
- Edited
I had added the headers in site config. Here are the headers that i added in site config. Without NGINX cache (NGINX Helper) its working fine.
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "ALLOW-FROM *";
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "strict-origin-when-cross-origin";
add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()";
add_header Content-Security-Policy "upgrade-insecure-requests";
Permission, referral and content security is what having problems.
aaP_hareeshnarayan1982
look confing PHP conf
aaP_hareeshnarayan1982
/www/server/nginx/conf
Modify this file. Pay attention to backup first
aaPanel_Kern Worked perfectly. Thanks for your help. I think you can add this into the guide.
Hello, I have done the steps here:
- Added these 4 lines in nginx configuration
fastcgi_cache_key "$scheme$request_method$host$request_uri"; fastcgi_cache_path /dev/shm/nginx-cache/wp levels=1:2 keys_zone=WORDPRESS:100m inactive=60m max_size=1g; fastcgi_cache_use_stale error timeout invalid_header http_500; fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
- Changed the site configuation from
include enable-php-81.conf;
toinclude enable-php-81-wpfastcgi.conf;
- Installed Nginx Helper plugin in Wordpress
- Added
define('RT_WP_NGINX_HELPER_CACHE_PATH','/dev/shm/nginx-cache/wp');
to wp-config.php
And everything seems to work, I get cache HIT in the header response for the wordpress site main page. Except when I try to go to any other page, I get 404. I notice that the url that doesn't work follows index.php
routing page forexample: https://domain.com/index.php/contact/
to go to contact page. What am I missing here? Any ideas?
Regards,
Tony
aaP_tony
Hello, if the website is brand new, it is recommended to use the website -- add site -- Wordpress deploy to deploy
aaPanel_Kern
Unfortunately it is not. I could try to add a new site and copy the content to this new site to test, will that work?
It is recommended to try it yourself
aaPanel_Kern
I added a new site using the wordpress deploy option. Then copy the old contents over to the new site. Unfortunately, I still have the same issue, meaning it is not the configuration? May be there is some settings/plugins that affect this fastCGI setting?
aaP_tony
Is your site brand new? If it is, you can directly deploy Wordpress deploy
Otherwise, you can only add related plug-ins by yourself
aaP_tony use wp migrate plugin, if you copy the files php fastcgi config file will be replaced.
aaPanel_Kern It is not a new site, that is why I want to add it after the fact. Everything seems to be working for the main page, I get Cache HIT but for other pages I get 404.
aaP_hareeshnarayan1982 That is what I'm trying to figure out, which WP config/file needs to be changed without reinstalling the site. If nothing works I'll have to try what you suggested.