Wordpress: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
Line 121: Line 121:
=React and Wordpress=
=React and Wordpress=
Had a dabble at this for a laugh. You can find it [[https://github.com/bibble235/world-clock-widget here]]. Here is the picture.<br>
Had a dabble at this for a laugh. You can find it [[https://github.com/bibble235/world-clock-widget here]]. Here is the picture.<br>
[[https://github.com/bibble235/world-clock-widget/blob/main/assets/screenshots/bill-widget.png]]
[https://github.com/bibble235/world-clock-widget/blob/main/assets/screenshots/bill-widget.png |200px]

Revision as of 22:46, 15 April 2025

Information

This page is to capture things about wordpress to help my gorgeous wifey

Nginx

This is to capture the setup for nginx and wordpress

Example 1 wordpress.example.com

Here we have an example where we use the domain name no subfolder

server {
listen 9080;
   server_name wordpress.example.com;

   root /var/www/wordpress;
   index index.php;

   server_tokens off;

   access_log /var/log/nginx/wordpress_access.log;
   error_log /var/log/nginx/wordpress_error.log;

   client_max_body_size 64M;

   location / {
      try_files $uri $uri/ /index.php?$args;
   }

   location ~ \.php$ {
      fastcgi_pass  unix:/run/php/php8.3-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi.conf;
    }
}

Example 2 wwww.example.com/wordpress

Here we have an example where we use the domain name and do use subfolder

server {
   listen 80;
   server_name wwww.example.com;

   root /var/lib/wordpress;
   index index.php;

   server_tokens off;

   access_log /var/log/nginx/wordpress_access.log;
   error_log /var/log/nginx/wordpress_error.log;

   client_max_body_size 64M;

   location / {
       try_files $uri $uri/ /index.php$is_args$args;#=404;
   }

   location ~ \.php$ {
      fastcgi_pass  unix:/run/php/php8.3-fpm.sock;
      fastcgi_index index.php;
      include fastcgi_params;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include /etc/nginx/fastcgi.conf;
    }
}

Starting Wordpress

With wordpress you need to start the fpm which I have trouble with, maybe my dyslexic brain

sudo systemctl restart nginx php8.3-fpm

PHP

Where is the ini

So there is always trouble finding the php.ini. To solve this I put a test.php in the direct and access that.

<?php
phpinfo();
?>

Then all is revealed. I this case it was in /etc/php/8.3/fpm/php.ini

Packages to install

When installing wordpress you need to install.

php8.3-fpm
php8.3-xmlrpc
php8.3-xml
php8.3-mbstring
php8.3-zip

PHP config changes

Increasing the upload and enabling the zip extension needs to be changed in the php.ini

  upload_max_filesize = 40M
  extension=zip

Changing the Domain Name

This is just plain difficult. So here is how I did it last time.

Dump the database and copy it for a spare

mysqldump -u root --default-character-set=utf8 --single-transaction wordpress >/tmp/wordpress_db.dmp
cp -rp /tmp/wordpress_db.dmp /tmp/wordpress_new.dmp

Create a new one

CREATE DATABASE wordpress_new_db;
GRANT ALL PRIVILEGES ON wordpress_new_db.* TO "wp_user"@"localhost";
FLUSH PRIVILEGES;

Now replace all of the instances of the old domain with the new one

sed -i -e    's/192.168.10.71\/wordpress/wordpress.example.com/g' /tmp/wordpress_new.dmp

Restore to new database

mysql -u root wordpress_new_db < /tmp/wordpress_new.dmp

I had to also change the following files but I think it depended on which themes people use. grep -r -i 192\.168\.10\.71 found them

wp-config.php
wp-content/uploads/uag-plugin/assets/11000/uag-js-11380.js
wp-content/astra-local-fonts/astra-local-fonts.css

React and Wordpress

Had a dabble at this for a laugh. You can find it [here]. Here is the picture.
|200px