Skip to content

Instantly share code, notes, and snippets.

@JoelLisenby
Last active February 20, 2024 17:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoelLisenby/dd6904297c8bd0e7f29afc9317f09308 to your computer and use it in GitHub Desktop.
Save JoelLisenby/dd6904297c8bd0e7f29afc9317f09308 to your computer and use it in GitHub Desktop.
linode_32G_setup

A Linode 32GB VPS configuration

Utilizing memcached (with php8.2-memcached) over localhost. We found a 5X improvement in speed from (15s to 3s) when viewing the events default view while logged in after enabling memcached in this way for The Events Ticktes/Calendar plugin when paired with WooCommerce.

Drop in object-cache.php to /wp-content/object-cache.php from: https://github.com/Automattic/wp-memcached

  • This script uses php8.2-memcache, not php8.2-memcached, but having both installed does not harm anything. They can both be installed safely.

/etc/mysql/mariadb.conf.d/50-server.cnf

#
# * Fine Tuning
#

innodb_buffer_pool_size = 18G
innodb_log_file_size = 6G
innodb_flush_method = O_DSYNC
innodb_read_io_threads = 64
innodb_write_io_threads = 64
innodb_io_capacity = 200
innodb_sort_buffer_size = 32M

# Thread Pool
thread_handling=pool-of-threads

# Temporary Table Size
tmp_table_size = 320M

# Buffer
sort_buffer_size = 32M
read_buffer_size = 16M
join_buffer_size = 32M
read_rnd_buffer_size = 16M

/etc/apache2/conf-enabled# ls

charset.conf            localized-error-pages.conf    php8.2-fpm.conf  serve-cgi-bin.conf
javascript-common.conf  other-vhosts-access-log.conf  security.conf

/etc/apache2/mods-enabled# ls

access_compat.load  authz_core.load  deflate.load  filter.load     mpm_event.load    proxy_http.load  setenvif.load
alias.conf          authz_host.load  dir.conf      http2.conf      negotiation.conf  proxy.load       socache_shmcb.load
alias.load          authz_user.load  dir.load      http2.load      negotiation.load  reqtimeout.conf  ssl.conf
auth_basic.load     autoindex.conf   env.load      mime.conf       proxy.conf        reqtimeout.load  ssl.load
authn_core.load     autoindex.load   fcgid.conf    mime.load       proxy_fcgi.load   rewrite.load     status.conf
authn_file.load     deflate.conf     fcgid.load    mpm_event.conf  proxy_http2.load  setenvif.conf    status.load

example /etc/apache2/sites-enabled/sitename.conf

<VirtualHost *:80>

  ServerName    www.sitename.com
  ServerAlias   sitename.com

  DocumentRoot  /home/site-sitename/www/public

  LogLevel warn

  <Directory /home/site-sitename/www/public>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

  <FilesMatch ".php$">
    SetHandler "proxy:unix:/var/run/php/php8.2-fpm_sitename.sock|fcgi://localhost/"
  </FilesMatch>

  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^sitename.com$ [NC,OR]
  RewriteCond %{HTTP_HOST} ^www.sitename.com$ [NC,OR]
  RewriteRule ^/(.*)$ https://www.sitename.com/$1 [END,NE,R=permanent]
</VirtualHost>

example /etc/apache2/sites-enabled/sitename-le-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost *:443>

  ServerName    www.sitename.com
  ServerAlias   sitename.com

  DocumentRoot  /home/site-sitename/www/public

  LogLevel warn

  <Directory /home/site-sitename/www/public>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
  </Directory>

  <FilesMatch ".php$">
    SetHandler "proxy:unix:/var/run/php/php8.2-fpm_sitename.sock|fcgi://localhost/"
  </FilesMatch>

  RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.

#   RewriteCond %{HTTP_HOST} ^sitename.com$ [NC,OR]
#   RewriteCond %{HTTP_HOST} ^www.sitename.com$ [NC,OR]
#   RewriteRule ^/(.*)$ https://www.sitename.com/$1 [END,NE,R=permanent]

Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/sitename.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/sitename.com/privkey.pem
</VirtualHost>
</IfModule>

apt install

php8.2-memcache
php8.2-memcached
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment