Restarting PHP FPM on Ubuntu 16.04
Probablyservice php7.3-fpm restart
Maybesystemctl restart php-fpm.service
Homebrew Locally
sudo brew services restart php74
Restarting PHP FPM on Ubuntu 16.04
Probablyservice php7.3-fpm restart
Maybesystemctl restart php-fpm.service
sudo brew services restart php74
New Ubuntu 16 server with MariaDB.
Tried using
“`SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘myGreatPassword’);
Password is changed but could not connect to DB from PHP.
Needed to update mysql.user table and set the Plugin field to an empty value (rather than unix_socket)!
SSLs are failing to renew
Maybe related to SSL redirection. I think LetsEncrypts requests that file over http
Could HSTS interfere?
Update: One domain was failing due to out of date LetsEncrypt config (pointing to an old install folder).
Got it going by disabling force HTTPS redirect, creating .well-known/acme-challenge and rerunning.
Should be able to delete .well-known and leave it to LetsEncrypt to create those.
Update2:
/etc/letsencrypt/renewal/www.mysquash.pro.conf referred to old install directory (I bump directory when upgrading Laravel).
So .well-known would have been created in wrong path. Pointed to mysquash54, but cannot test yet as now there have been too many recent fails of the domain 🙁
I may have passed through the correct nginx config along the way and not known it.
cd /opt/certbot
./certbot-auto certonly --webroot -w /var/www/html \
-d tutorial.serverops.io \
--non-interactive --agree-tos --email me@example.com
101 Demo
[code]
<?php
// Instantiate an Amazon S3 client.
$s3 = new S3Client([
‘version’ => ‘latest’,
‘region’ => ‘ap-southeast-2’, //Sydney
‘scheme’ => ‘http’, //omit, or https on servers that support it
‘credentials’ => [
‘key’ => ‘ YOUR KEY ‘,
‘secret’ => ‘ YOUR SECRET ‘
]
]);
// Upload a publicly accessible file. The file size and type are determined by the SDK.
try {
$s3->putObject([
‘Bucket’ => ‘yourbucket’,
‘Key’ => ‘path/to/key.png’,
‘Body’ => fopen(‘my-picture.png’, ‘r’),
‘ACL’ => ‘public-read’,
]);
echo "<p>Picture uploaded [tick]</p>";
} catch (Aws\Exception\S3Exception $e) {
echo "There was an error uploading the file.\n";
}
?>
[/code]
[code]
ps aux –sort -rss | head -n10
[/code]
Generate CSR on your server. Paste the contents of .csr into Namecheap’s interface.
(The .key file is referenced by Apache later along with the certificate)
[code]
openssl req -new -newkey rsa:2048 -nodes -keyout server.key -out server.csr[/code]
(use www.mikehealy.com.au as my FQDN)
Create crazy long CNAME in DNS to verify. Seems to replace email validation.
Overwrite certificate files in /root on server with new ones from Comodo. Restart Apache, config can stay the same.
I have PHP scripts to backup MySQL databases and FTP them to another server.
Edit the crontab file and add your tasks
[code]
crontab -e
…
5 12 * * * php /var/www/mysite/tools/autobackup/run_this_file.php
[/code]
The paths in the PHP script were relative to the user. Needed to add this at the top of PHP scripts to be relative to the script
[code]
chdir(__DIR__);
[/code]
(e.g. WordPress site)
mysqldump -u username -p dbname | gzip > myexport.sql.gz
Type your password. Done.