• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Improving MariaDB performance + Increase Web loading

fd_paz

Basic Pleskian
Hi,

I had a VPS with 4 vCPU, 8 GB RAM, 160 GB SSD Storage on which I had about ten websites all made with WordPress, not very heavy with few visits, and despite that I used Cloudflare CDN (free version), all my websites were slow, and I often received error 542 or Swap error. I also tried several WordPress Cache Plugins and got better but not optimal results.

I changed the VPS and got one with 8 vCPU, 24 GB RAM, 240 GB SSD Storage with IONOS hoping to get more performance, but unfortunately the situation has not changed much.

I am developing a WordPress based Website which needs a lot of Plugins installed and in the development phase I cannot enable Cache and because of this I am losing a lot of time updating pages etc. and with such a VPS resource I think I should expect to get the best results.

I am using CentOs 8 with the latest version of Plesk Obsidian with MariaDB 10.5.8. The Plesk control panel loads very quickly, but my websites do not, and I can see I am using very little server resources, so I am guessing there's something wrong with my server configuration.

I have a few questions which I write down below:

1. I saw that it is required to make changes in MariaDB and increase "innodb_buffer_pool_size", but I cannot find a tutorial for CentOs 8 with MariaDB 10.5.8.

2. How do I increase innodb_buffer_pool_size? Which file should I edit? And given my VPS resources what values should I set?

3. In the PHP section of the website, what is the best configuration? I enclose a screenshot of my current configuration.

4. And after finishing the development of the website, to improve the loading speed, is it better to use Nginx or install LiteSpeed (considering the resources of my VPS)?

Thank you very much
 

Attachments

  • php-config.png
    php-config.png
    68.7 KB · Views: 105
1) Changes to the MariaDB configuration ought to be made in /etc/my.cnf or include files from that starting point. For a Wordpress website it is not very likely that the database is the bottleneck. Simply looking a
showprocesslist;
can reveal if the database is actually doing a lot or if it is just sitting there waiting for the next request. Increasing buffer sizes is generally a good idea, unless you don't have much RAM available for that.
There are lots of other, more effective methods to speed up database transactions. The most major mistake most developers make is that they are using lots of UNION statements and are using LEFT JOIN, RIGHT JOIN instead of the much more effective INNER JOIN (which creates much much much smaller cartesian products of combined queries). So most of the time, database issues are not database issues but software development issues.

2) The setting goes into /etc/my.cnf or include files that are included there. The size to set depends on the RAM that other components of your system need.

3) A memory limit of 3G per script is extreme and not useful at all, because only runaway scripts (e.g. scripts caught in a while...next loop) that occupy more and more ram because they erroneously create more and more variables use that much RAM. A value of 512M is more than enough for most applications and protects your server better against processes that occupy much RAM for no reason.
A max execution time of 1600 seconds is insane. Normal scripts run for less than a second. Bad scripts run a few seconds. Insane scripts that for example try to process large uploads or images straight forward instead of using asynchronous techniques might run a dozen seconds or longer. Setting 1600 seconds will only allow faulty scripts to occupy processes in the web server for 26 minutes for no reason. A normal max value would be 120 seconds the most.
A max input time of 2400 seconds is absolutely nuts. No way this can have any benefit. It will only allow hackers to bombard your website with long running requests and will allow faulty scripts to occupy a process on the system for 40 minutes for no reason. A normal max value would be 120 seconds the most. For upload of large files use an asynchronous uploader.
Upload max file size of 128 MB could maybe work if you are lucky, but again: asynchronous uploads are a way better choice.

4) Stick with Nginx/Apache combination. You'll only install lots of additional problems when deviating from the default Plesk setup. Nginx can sort the static files out, so that only .php files will still be processed by Apache. If you want to get really fast, use Nginx only (disable the "proxy" option in Nginx/Apache web server settings), change PHP to PHP FPM by Nginx. In that case however, you need to convert your .htaccess rules to an Nginx format and add these rules to the Nginx configuration.

5) (I know there was no "5", but this is the most important point): The more plugins, the slower Wordpress gets, because each function runs through all the hooks and all the plugins to check whether it needs to do something in addition to what it normally does. Very many themes and plugins are really badly made software with no attention to speed details. The only way to really speed the software up is to go through the code and correct it. There are very many common mistakes that many programmers make. For example in PHP many set variables over and over again inside loops while it would be much smarter and time saving to set them outside loops and reuse them inside. Many are using slow preg_replace, ereg etc. functions in PHP or use mb_str_replace where an str_replace would be sufficient. Many are parsing/replacing variables in long strings while it would be smarter to first shorten the string, then run a replace on it. From array processing through incrementing variables: There are tons of things where you can speed PHP up, but most developers just don't care about it. All the lost time and wasted cpu power adds up from plugin to plugin. You might only use 50 ms on one, but if you have 10 plugins, this adds up to half a second etc.
 
Herzlichen Dank Peter!

- Regarding point 2. it seems that in my case I have to edit "/my.cnf.d/server.cnf". Colud you please confirm this? I am not very experienced in Linux.

- Which commands should I use in ssh?

- Can I use FTP, download the file, edit it with Notepad++ and then upload it back to the server?

- I have a lot of RAM available. I have read that the value can be between 70%-80% of total Ram. Do you think 17GB is OK in my case?

- As for point 3, I followed your instructions, and everything works fine. Thanks again!

- Regarding point 4., I followed your instructions, and the site has become very fast, but it shows me the home page, and when I want to display one of the "non-root" pages, I get the error "Not Found The requested document was not found on this server.

In the "Serve static files directly by nginx" option I entered: "ac3|atom|avi|bmp|bz2|css|csv|cue|dat|doc|docx|dts|eot|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|map|mid|midi|mkv|mp3|mp4|mpeg|mpg|m4a|ogg|ogv|otf|pdf|png|ppt|pptx|qt|rar|rm|rss|rtf|svg|svgz|swf|tar|tgz|ttf|txt|wav|webp|woff|woff2|xls|xlsx|zip".

- Also I would like to know which is the best setting for Cache and Cache timeout? I am attaching the screenshot of my setting.

- Regarding point 5, I use Divi as theme. Should I change it? Is it a valid and advisable theme or is it better not to use it?

- I have installed about 40 plugins for what I need. Are they too many?

- Then I would like to know if there are differences between heavier and less heavy plugins? Most of my plugins weigh less than 1M. I have WPML which weighs 22M. Maybe it is better to use Translatepress Multilingual which weighs only 4M?

- Since I am in the development phase, I also have several Plugins that I have uploaded, but have not installed. Can Plugins that are not installed also reduce the speed?

Many thanks again in advance
 

Attachments

  • nginx-cache-config.png
    nginx-cache-config.png
    46.8 KB · Views: 44
- Regarding point 2. it seems that in my case I have to edit "/my.cnf.d/server.cnf". Colud you please confirm this? I am not very experienced in Linux.
Yes, it depends on your operating system and database server. If this is the file that contains sections like "[mysqld]" it's probably the right file.

- Which commands should I use in ssh?
For what?

- Can I use FTP, download the file, edit it with Notepad++ and then upload it back to the server?
No, because the file permissions don't allow for it. It is better to use vim or vi to edit the file directly on the server. Make a backup of it into another directory before you edit it, so that you can revert changes in case there is a mistake.

- I have a lot of RAM available. I have read that the value can be between 70%-80% of total Ram. Do you think 17GB is OK in my case?
I think that would be way more than enough. It might be better to gradually increase the setting.

- Regarding point 4., I followed your instructions, and the site has become very fast, but it shows me the home page, and when I want to display one of the "non-root" pages, I get the error "Not Found The requested document was not found on this server.

In the "Serve static files directly by nginx" option I entered: "ac3|atom|avi|bmp|bz2|css|csv|cue|dat|doc|docx|dts|eot|exe|flv|gif|gz|htm|html|ico|img|iso|jpeg|jpg|js|map|mid|midi|mkv|mp3|mp4|mpeg|mpg|m4a|ogg|ogv|otf|pdf|png|ppt|pptx|qt|rar|rm|rss|rtf|svg|svgz|swf|tar|tgz|ttf|txt|wav|webp|woff|woff2|xls|xlsx|zip".
When you use Nginx-only hosting (when you disabled the proxy option), this setting does not matter, because Nginx serves all files anyway.

- Also I would like to know which is the best setting for Cache and Cache timeout? I am attaching the screenshot of my setting.
For development phase: No caching, because Nginx has the the nasty habit to sometimes ignoring the settings and keeping delivering static files from cache although it should have long expired. This can lead to the false impression that wrong data is rendered by a script.

For production: It depends on the traffic. 5 minutes is normally good, RAM is o.k., too.

- Regarding point 5, I use Divi as theme. Should I change it? Is it a valid and advisable theme or is it better not to use it?
It's a widely used theme. No issues with using it. It's not optimized for speed though, but most themes are not.

- I have installed about 40 plugins for what I need. Are they too many?
Absolutely too many. If you have 40 active plugins and each hooks to some component and only needs 1 ms to say "hey, I don't have anything to add to this function", you'll still loose 40 ms on each and every transaction.

- Then I would like to know if there are differences between heavier and less heavy plugins? Most of my plugins weigh less than 1M. I have WPML which weighs 22M. Maybe it is better to use Translatepress Multilingual which weighs only 4M?
The disk storage space of a plugin does not influence its speed much. There is a slightly longer loading time, but normally, hard disks are cached, so it's a matter of nano seconds.

- Since I am in the development phase, I also have several Plugins that I have uploaded, but have not installed. Can Plugins that are not installed also reduce the speed?
No, plugins that have been uploaded, but are not installed, do not influence the rendering of a page.
 
Thanks again Peter!

Now I have a much clearer general picture, but I also have some doubts about the architecture of what I am developing.

I explain better: a part of my website, is dedicated to the usual pages such as presentation, services, etc., but the main part is a Portal that uses Gravity Forms, Gravity Flow and different Add-ons and users can interact by filling out registration forms or sending requests.

- At this point I have the doubt that maybe it is better that I divide my website in two parts and install two WordPress: one for the representative part (about, services, etc.) and the other one I use for the Portal. This way I can reduce/divide the number of Plugins installed, because there are several Plugins that are only needed for the Portal section. Or should I install a WordPress Multisite?

- Since my website is multilingual, I currently use Wildcard to display the other languages in subdomains in WPML. As far as speed is concerned, is it OK to use Wildcard or is it better to create real subdomains?

- I meant the ssh commands for backing up and editing "/my.cnf.d/server.cnf". And also, the instructions for recovering the backup if things go wrong. Which ones should I use?

- I solved the problem with the other pages in Nginx, following the instructions. I saw that there is also a Plesk Extension .htaccess to Nginx converter (beta). I installed it, but it did not work.

- Should I also apply the same configurations for the Wildcard subdomain as for its main domain (Php, Nginx, etc.)?

Nochmals vielen Dank im Voraus!
 
- At this point I have the doubt that maybe it is better that I divide my website in two parts and install two WordPress: one for the representative part (about, services, etc.) and the other one I use for the Portal. This way I can reduce/divide the number of Plugins installed, because there are several Plugins that are only needed for the Portal section. Or should I install a WordPress Multisite?
If you can decrease the number of plugins that you need in a website, it can be a good idea to split the websites into two.
Wordpress Multisite might make maintenance for the user easier, but the more interaction there is in sites the more issues can arise. I would not use it.

- Since my website is multilingual, I currently use Wildcard to display the other languages in subdomains in WPML. As far as speed is concerned, is it OK to use Wildcard or is it better to create real subdomains?
In terms of speed it should make no difference.

- I meant the ssh commands for backing up and editing "/my.cnf.d/server.cnf". And also, the instructions for recovering the backup if things go wrong. Which ones should I use?
cp <source file> <target destination and file>
for example
cp /my.cnf.d/server.cnf /home/server.cnf.bak

- I solved the problem with the other pages in Nginx, following the instructions. I saw that there is also a Plesk Extension .htaccess to Nginx converter (beta). I installed it, but it did not work.
It might not be able to convert all rules of an .htaccess file into the proper syntax of Nginx. Manual work is needed. Plus, you need to be sure that plugins don't update .htaccess automatically in the future, because changes there won't be mirrored into the Nginx configuration.

- Should I also apply the same configurations for the Wildcard subdomain as for its main domain (Php, Nginx, etc.)?
If the wildcard is an alias or redirect: no, no changes or edits needed
[edited] This was unprecise. An alias cannot be a wildcard. Only domains or subdomains can be wildcards.

If the wildcard is a website: yes
 
Last edited:
Two things I did not understand in your reply. Could you please explain further:
- you need to be sure that plugins don't update .htaccess automatically in the future, because changes there won't be mirrored into the Nginx configuration.

- If the wildcard is an alias or redirect: no, no changes or edits needed
If the wildcard is a website: yes

Thank you very much again
 
Two things I did not understand in your reply. Could you please explain further:
When you convert .htaccess rules to Nginx rules and apply these rules in Nginx, that's a static fix. If the .htaccess content is modified at any later time, you need to repeat that process and convert the updated rules again, so that Nginx can use them. There is no "on the fly", "live" conversion.

Your wildcard subdomain can either be web space or an alias [edit: This was unprecise, a wildcard cannot be an alias; however the conclusion that an alias does not a separate web space configuration remains correct] or a redirect. If it is web space and has its own document root directory (like your main domain), you need to apply speed optimization to that website separates just as you are doing it with your main domain. If it is a redirect or an alias, you do not need to do anything, because there is no speed optimization for it. In case of an alias, it will simply use the settings of the main domain.
 
Last edited:
So I have to keep an eye on the .htaccess file at all times and I don't even have to delete it even if I use Nginx. Right?

I didn't know it was possible to create a wildcard as an alias.
I have always used the "Add Subdomain" button to create Wildcards and since there are folders then I have to apply the same settings as for my main domain.

Thank you again
 

Attachments

  • subdomain.png
    subdomain.png
    14.8 KB · Views: 14
Hi again,

I have changed the settings on my domain (I have not made the changes in MariadB yet) and I already feel that the pages load much faster even though I still get the F category with Gtmetrix as before.

- Regarding Wildcard as an Alias I am a bit puzzled. Can I create a Wildcard as Alias in Plesk? Or did you mean to create *.domain.tld in my DNS panel?

- In line with saving on site load times, would it be better to use Snippets instead of small plugins where possible? Would this help?

- Since I own a VPS and have control of Plesk Panel, I am able to install security extensions and thus I don't have to install security Plugins like Ithemes Security, etc. in WordPress which take up a lot of Memory and CPU. Is this correct?

- I managed to convert my .htaccess to Nginx, but it doesn't work. Below I send both. How should I modify it to make it work?

Code:
# BEGIN WP Rocket v3.8
# Use UTF-8 encoding for anything served text/plain or text/html
AddDefaultCharset UTF-8
# Force UTF-8 for a number of file formats
<IfModule mod_mime.c>
AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
</IfModule>
# FileETag None is not enough for every server.
<IfModule mod_headers.c>
Header unset ETag
</IfModule>
# Since we’re sending far-future expires, we don’t need ETags for static content.
# developer.yahoo.com/performance/rules.html#etags
FileETag None
<IfModule mod_alias.c>
<FilesMatch "\.(html|htm|rtf|rtx|txt|xsd|xsl|xml)$">
<IfModule mod_headers.c>
Header set X-Powered-By "WP Rocket/3.8"
Header unset Pragma
Header append Cache-Control "public"
Header unset Last-Modified
</IfModule>
</FilesMatch>
<FilesMatch "\.(css|htc|js|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
<IfModule mod_headers.c>
Header unset Pragma
Header append Cache-Control "public"
</IfModule>
</FilesMatch>
</IfModule>
# Expires headers (for better cache control)
<IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault                              "access plus 1 month"
    # cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
    ExpiresByType text/cache-manifest           "access plus 0 seconds"
    # Your document html
    ExpiresByType text/html                     "access plus 0 seconds"
    # Data
    ExpiresByType text/xml                      "access plus 0 seconds"
    ExpiresByType application/xml               "access plus 0 seconds"
    ExpiresByType application/json              "access plus 0 seconds"
    # Feed
    ExpiresByType application/rss+xml           "access plus 1 hour"
    ExpiresByType application/atom+xml          "access plus 1 hour"
    # Favicon (cannot be renamed)
    ExpiresByType image/x-icon                  "access plus 1 week"
    # Media: images, video, audio
    ExpiresByType image/gif                     "access plus 4 months"
    ExpiresByType image/png                     "access plus 4 months"
    ExpiresByType image/jpeg                    "access plus 4 months"
    ExpiresByType image/webp                    "access plus 4 months"
    ExpiresByType video/ogg                     "access plus 4 months"
    ExpiresByType audio/ogg                     "access plus 4 months"
    ExpiresByType video/mp4                     "access plus 4 months"
    ExpiresByType video/webm                    "access plus 4 months"
    # HTC files  (css3pie)
    ExpiresByType text/x-component              "access plus 1 month"
    # Webfonts
    ExpiresByType font/ttf                      "access plus 4 months"
    ExpiresByType font/otf                      "access plus 4 months"
    ExpiresByType font/woff                     "access plus 4 months"
    ExpiresByType font/woff2                    "access plus 4 months"
    ExpiresByType image/svg+xml                 "access plus 1 month"
    ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
    # CSS and JavaScript
    ExpiresByType text/css                      "access plus 1 year"
    ExpiresByType application/javascript        "access plus 1 year"
</IfModule>
# Gzip compression
<IfModule mod_deflate.c>
# Active compression
SetOutputFilter DEFLATE
# Force deflate for mangled headers
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
# Don’t compress images and other uncompressible content
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|rar|zip|exe|flv|mov|wma|mp3|avi|swf|mp?g|mp4|webm|webp|pdf)$ no-gzip dont-vary
</IfModule>
</IfModule>
# Compress all output labeled with one of the following MIME-types
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/atom+xml \
                                  application/javascript \
                                  application/json \
                                  application/rss+xml \
                                  application/vnd.ms-fontobject \
                                  application/x-font-ttf \
                                  application/xhtml+xml \
                                  application/xml \
                                  font/opentype \
                                  image/svg+xml \
                                  image/x-icon \
                                  text/css \
                                  text/html \
                                  text/plain \
                                  text/x-component \
                                  text/xml
</IfModule>
<IfModule mod_headers.c>
Header append Vary: Accept-Encoding
</IfModule>
</IfModule>
<IfModule mod_mime.c>
AddType text/html .html_gzip
AddEncoding gzip .html_gzip
</IfModule>
<IfModule mod_setenvif.c>
SetEnvIfNoCase Request_URI \.html_gzip$ no-gzip
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} on [OR]
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} https
RewriteRule .* - [E=WPR_SSL:-https]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=WPR_ENC:_gzip]
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} =""
RewriteCond %{HTTP:Cookie} !(wordpress_logged_in_.+|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_) [NC]
RewriteCond %{REQUEST_URI} !^(/(.+/)?feed/?.+/?|/(?:.+/)?embed/|/(index\.php/)?wp\-json(/.*|$))$ [NC]
RewriteCond %{HTTP_USER_AGENT} !^(facebookexternalhit).* [NC]
RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" -f
RewriteRule .* "/wp-content/cache/wp-rocket/%{HTTP_HOST}%{REQUEST_URI}/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" [L]
</IfModule>
# END WP Rocket
# BEGIN LSCACHE
# END LSCACHE
# BEGIN NON_LSCACHE
# END NON_LSCACHE
# BEGIN Really_Simple_SSL_CSP_Report_Only
<IfModule mod_headers.c>
Header always set Content-Security-Policy-Report-Only: "default-src 'self'; script-src 'self' 'unsafe-inline'; script-src-elem 'self'; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'; report-uri https://xxxx.xxx/wp-json/rsssl/v1/csp?rsssl_apitoken=1607500379 "
</IfModule>
# END Really_Simple_SSL_CSP_Report_Only
# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# BEGIN wtfdivi
<ifModule mod_deflate.c>
Addtype font/truetype .ttf
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/xhtml+xml application/rss+xml application/x-javascript application/javascript text/javascript font/truetype
</ifModule>
# END wtfdivi

Nginx:

Code:
#ignored: condition 0
if ($server_port ~ "^443$"){
    set $rule_0 1;
}
if ($http_x_forwarded-proto ~ "https"){
    set $rule_0 1;
}
if ($rule_0 = "1"){
    setenv WPR_SSL:-https;
#ignored: "-" thing used or unknown variable in regex/rew
}
if ($http_accept_encoding ~ "gzip"){
    set $rule_1 1$rule_1;
}
if ($rule_1 = "1"){
    setenv WPR_ENC:_gzip;
#ignored: "-" thing used or unknown variable in regex/rew
}
if ($request_method ~ "GET"){
    set $rule_2 1$rule_2;
}
if ($args ~ "="""){
    set $rule_2 2$rule_2;
}
if ($http_cookie !~* "(wordpress_logged_in_.+|wp-postpass_|wptouch_switch_toggle|comment_author_|comment_author_email_)"){
    set $rule_2 3$rule_2;
}
if ($uri !~* "^(/(.+/)?feed/?.+/?|/(?:.+/)?embed/|/(index\.php/)?wp\-json(/.*|$))$"){
    set $rule_2 4$rule_2;
}
if ($http_user_agent !~* "^(facebookexternalhit).*"){
    set $rule_2 5$rule_2;
}
if (-f "$document_root/wp-content/cache/wp-rocket/$http_host$uri/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}"){
    set $rule_2 6$rule_2;
}
if ($rule_2 = "654321"){
    rewrite /.* /"/wp-content/cache/wp-rocket/$http_host$uri/index%{ENV:WPR_SSL}%{ENV:WPR_WEBP}.html%{ENV:WPR_ENC}" last;
}
    setenv HTTP_AUTHORIZATION:$http_authorization;
#ignored: "-" thing used or unknown variable in regex/rew
#ignored: "-" thing used or unknown variable in regex/rew
if (!-f $request_filename){
    set $rule_5 1$rule_5;
}
if (!-d $request_filename){
    set $rule_5 2$rule_5;
}
if ($rule_5 = "21"){
    rewrite /. /index.php last;
}

Thank you very much in advance
 
I am so sorry, but I really don't have the time to go through all your programming and configuration work. If the automatic translation of the .htaccess file into Nginx rules does not work for your project, you will need to learn how to convert all the rules manually. I may also not be a good idea to do it at all, due to the very many rules your file contains.
 
Thank you very much for your reply. You were very kind to give me a lot of information in simple words that I had not received so far.
As the last question could you please answer me the issue regarding the Alias?

Nochmals vielen Dank und einen schönen Tag.
 
I was unclear in one sentence. It is correct that an alias cannot be a wildcard. A wildcard can only be used as a subdomain entry. An alias must always be a specific domain or subdomain.
 
1) Changes to the MariaDB configuration ought to be made in /etc/my.cnf or include files from that starting point. For a Wordpress website it is not very likely that the database is the bottleneck. Simply looking a
showprocesslist;
can reveal if the database is actually doing a lot or if it is just sitting there waiting for the next request. Increasing buffer sizes is generally a good idea, unless you don't have much RAM available for that.
There are lots of other, more effective methods to speed up database transactions. The most major mistake most developers make is that they are using lots of UNION statements and are using LEFT JOIN, RIGHT JOIN instead of the much more effective INNER JOIN (which creates much much much smaller cartesian products of combined queries). So most of the time, database issues are not database issues but software development issues.

2) The setting goes into /etc/my.cnf or include files that are included there. The size to set depends on the RAM that other components of your system need.

3) A memory limit of 3G per script is extreme and not useful at all, because only runaway scripts (e.g. scripts caught in a while...next loop) that occupy more and more ram because they erroneously create more and more variables use that much RAM. A value of 512M is more than enough for most applications and protects your server better against processes that occupy much RAM for no reason.
A max execution time of 1600 seconds is insane. Normal scripts run for less than a second. Bad scripts run a few seconds. Insane scripts that for example try to process large uploads or images straight forward instead of using asynchronous techniques might run a dozen seconds or longer. Setting 1600 seconds will only allow faulty scripts to occupy processes in the web server for 26 minutes for no reason. A normal max value would be 120 seconds the most.
A max input time of 2400 seconds is absolutely nuts. No way this can have any benefit. It will only allow hackers to bombard your website with long running requests and will allow faulty scripts to occupy a process on the system for 40 minutes for no reason. A normal max value would be 120 seconds the most. For upload of large files use an asynchronous uploader.
Upload max file size of 128 MB could maybe work if you are lucky, but again: asynchronous uploads are a way better choice.

4) Stick with Nginx/Apache combination. You'll only install lots of additional problems when deviating from the default Plesk setup. Nginx can sort the static files out, so that only .php files will still be processed by Apache. If you want to get really fast, use Nginx only (disable the "proxy" option in Nginx/Apache web server settings), change PHP to PHP FPM by Nginx. In that case however, you need to convert your .htaccess rules to an Nginx format and add these rules to the Nginx configuration.

5) (I know there was no "5", but this is the most important point): The more plugins, the slower Wordpress gets, because each function runs through all the hooks and all the plugins to check whether it needs to do something in addition to what it normally does. Very many themes and plugins are really badly made software with no attention to speed details. The only way to really speed the software up is to go through the code and correct it. There are very many common mistakes that many programmers make. For example in PHP many set variables over and over again inside loops while it would be much smarter and time saving to set them outside loops and reuse them inside. Many are using slow preg_replace, ereg etc. functions in PHP or use mb_str_replace where an str_replace would be sufficient. Many are parsing/replacing variables in long strings while it would be smarter to first shorten the string, then run a replace on it. From array processing through incrementing variables: There are tons of things where you can speed PHP up, but most developers just don't care about it. All the lost time and wasted cpu power adds up from plugin to plugin. You might only use 50 ms on one, but if you have 10 plugins, this adds up to half a second etc.
Thank you very much for such a detailed answer! I've been thinking about moving my business online for a long time. Due to the coronavirus, I can't pay for the rental space and so I will most likely have to start running my business online. This may seem very easy at first but it's actually quite difficult because the Internet is full of similar services that I now have to compete with. I have already created a website but now I will have to buy the website traffic from. I hope these guys do a good job.
 
Last edited by a moderator:
Back
Top