Categories
Servers

LetsEncrypt SSL Failures

SSLs are failing to renew

  • MySquash / UltraVulture due for renewal in <1 month
  • Failing because Nginx is not allowing access to .well-known dir
  • Need to debug syntax and rerun certbot-auto 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.

Categories
Laravel

Laravel Sessions Gotcha

Lost a lot of time debugging missing values in the Session. They were set in a controller method which I then dd().

Killing the process seems to stop the value being saved in the session. It showed up in that method, but the request didn’t complete so the value was missing from subsequent requests.

Upshot: Let the request complete without dd() to save sesssion values.

 

Categories
JavaScript Laravel

Laravel Elixir Notes

gulp –production minifes and removes console.log which may not be what you want! Especially when debugging the process.

 

Categories
Servers

Add Lets Encrypt Domain

cd /opt/certbot

./certbot-auto certonly --webroot -w /var/www/html \
-d tutorial.serverops.io \
--non-interactive --agree-tos --email me@example.com
Categories
Laravel

Laravel Windows Devs Gotchas

Homestead is slow. Native OS is fast but watch out for these issues.

  • Probably no Redis. Tagged caching not possible with file system
  • Storage facade by default writes to storage/ and uses a symlink for public files from the /public dir. Windows doesn’t have symlinks. (Could probably fix with environment config files)
Categories
PHP

Installing PHPUnit

Download latest version

  1. Saved .phar in c:\server\bin
  2. Add c:\server\bin to PATH
  3. Follow their instructions for creating  a .cmd wrapper
  4. Test by calling phpunit –version from cmd

Not sure how Laravel connects its tests/ to phpunit yet. Also not sure if version mismatch between Laravel and latest matters.

Categories
Laravel

Monitor Laravel SQL Queries

DB::listen(function($sql) {
    var_dump($sql->sql);
});

Categories
PHP

PHP7 Windows OpenSSL

I just upgraded from PHP 5.6.20 to 7.0.13 on Windows 10.

The existing Apache 2.4 installation uses Open SSL DLLs incompatible with PHP7.

I copied these two files from php7 to apache/bin

  • libeay32.dll
  • ssleay32.dll

Seems to be working now

Categories
Servers

Uploading to AWS S3

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]

Categories
Servers

Ubuntu Memory Usage

[code]
ps aux –sort -rss | head -n10
[/code]