3 Ways to Center a Div

Somehow I always seems to struggle to center block elements so I write a small note (mostly for myself) how to do it.

1. Old School margin:auto

margin-left: auto;
margin-right: auto;

2. Flex and the justify-content



3. Grid and setting the place-items

place-items: center;
Azure Windows

Making WordPress fast(er) on Azure App Service

I noticed that WordPress and WordPress Multisite on Azure does not perform well. It seems that anything written in PHP is not the first class citizen on Azure and PHP runtime as well as MySQL behaves differenly on Azure than running it on VM or Docker.

I was not able to make WordPress as fast as it would be on VM but I got close. Please notice that I am running App Service under Windows Operating System. If you have change to run this under Linux you will likely get much better performance and some of the tips below may not be relevent for you. In any case fine tuning these settings are always solution specific but if you have performance problems I hope my findings helps you.

Step 0 – App and SQL plans

App Service
You should run the App Service in minimum P1V2. Everything smaller in a bigger solution becomes slower. This gives 210 total ACU 3.5 GB memory for the app.

Azure Database for MySQL server

Gen 5 with 100 GB and 4 cores seemed to work for me. I noticed that there was not much of difference if you choose Basic with 2 vCores. If you don’t need large storage I recommend trying out Basic first but notice that you cannot scale from Basic to General Purpose with a click of a button. It requires moving db’s manually.

Step 1 – App Service Settings

Changes Made: 

  • PHP version 7.4
  • Set the Platform as 64 bit
  • Set HTTP-version to 2.0
  • Set the site to ‘Always on
  • Turn Off the Affinity Cookie

Step 2 – Extend PHP.INI

Open the solution in Kudu or FTP client and create new folder at d:\home\site\ini on your app structure. Under new ini -folder create settings.ini and add following settings:

output_buffering = Off;

– Defines the maximum allowed size (in kilobytes) for a single file to be cached.

– This sets the maximum amount of memory in bytes that a script is allowed to allocate.

upload_max_filesize, post_max_size, max_execution_time, max_input_time
– You may not need this. I got some bigger file execution operations in relation to a WP plugin that required extend size and execution times. Not exactly related to performance.

– I don’t really understand why this is set on Azure. App seems to run better if it is disabled?

After adding the settings.ini under d:\home\site\ini\ folder open App Service > Configuration > Application Settings and the folder to the key called PHP_INI_SCAN_DIR=d:\home\site\ini\ like this:

Save and restart the App Service. Now you should have custom INI for your app where you can adjust default PHP settings.

You can verify that your settings are correct by creating phpinfotest.php with <?php phpinfo(); ?> in it and uploading it to the webroot. Then on your browser you can see this file and see all your settings.

Redis Object Cache and App Service Local Caching

I have tried both of these and neither them helped me but it might help on some installations. So I will write few words about them

App Service Local Caching

The Azure App Service Local Cache feature provides a web role view of your content. This content is a write-but-discard cache of your storage content that is created asynchronously on-site startup. When the cache is ready, the site is switched to run against the cached content. Enabling local caching will change how the storage works for your app service. This is only recommended for more static WordPress instances and not for WordPress instances that have new posts or pages.

To enable it add these settings to your application settings


I have heard and read this is great setting on some solutions but for me performance got 10 x worse with local caching. So I drop it.

Redis Object Cache

Object caching allows your web application to cache the results of queries as objects in low latency memory based storage. But this is also something that may not work for your solution. I did not have good luck on my solution, on my instance speed got 10-15% slower after enabling Redis. There are a few caveats to using the Redis Object Cache approach on WordPress. The caching mechanism does not work well if you have a lot of plugins and themes installed. This is due to the fact that all their data would need to be cached as well with Redis. But it is worth of testing since Azure Cache for Redis is easy to setup and test it. If you don’t see benefits on it you can just delete it. I followed this blog post to configure caching with Redis.

If you have a lot of visitor on the site I think you should definetly evaluate Redis.

Cache Plugins for WordPress

I tested different cache plugins that work with WordPress Multisite and I settled with WP Super Cache. This plugin is simple and quick to configure. If you install the plugin and just enable it it works. Only custom setting I added was in the advanced section I extended cache recycling to 1 hour.

Azure Content Delivery Network (CDN)

Azure Content Delivery Network (CDN) lets you reduce load times, save bandwidth and speed responsiveness. You can use the same cache plugin WP Super Cache to enable CDN.

Other tips

A few tips to improve WordPress performance and overall settings on Azure Web App are listed below:

      <add sequence="xmlrpc.php" />
  • Add .woff mimetypes
      <mimeMap fileExtension="woff" mimeType="application/font-woff" />
      <mimeMap fileExtension="woff2" mimeType="application/font-woff2" /> 
        <remove fileExtension=".mp4" />
        <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />


It is possible to get decent performance on WordPress solutions on App Service but I am still in doubt if this is the better solution than running on Virtual Machine or in the container. I never was able to get close to performance that I can get on Virtual Machine with dedicated application server and MySQL server under Linux. Although, Azure is getting better and faster everyday and there is no doubt that eventually it will be at least as fast as VM.


From AzureRM to AZ

The Az PowerShell module has been for a while the recommended PowerShell module for interacting with Azure. Here is the quick guide how to install AZ on Windows 10.

Powershell script to un-install Azure/AzureRM and install AZ

# Remove base modules:
uninstall-module Azure
uninstall-module AzureRM

# Remove the rest
$Modules = Get-Module -ListAvailable | Where {$_.Name -like 'AzureRM.*'}
Foreach ($Module in $Modules) {Uninstall-Module $Module}

# Install AZ
if ($PSVersionTable.PSEdition -eq 'Desktop' -and (Get-Module -Name AzureRM -ListAvailable)) {
    Write-Warning -Message ('Az module not installed. Having both the AzureRM and ' +
      'Az modules installed at the same time is not supported.')
} else {
    Install-Module -Name Az -AllowClobber -Scope AllUsers -Force

# Connect to Azure with a browser sign in token

Further reading

Build your skills with Microsoft Learn

Other Azure PowerShell modules

Computers Windows

Tip of today: Windows Server restart on given time

How to Schedule a Reboot. This should work also on workstation.

This will restart in 6 hours

Invoke-Command -ComputerName NameOfServer {shutdown /r /t 21600}

This will restart in 1 hour

Invoke-Command -ComputerName NameOfServer {shutdown /r /t 3600}

This will restart in 19th of October 2025 at 12:00 hour

schtasks /create /tn “Scheduled Reboot” /tr “shutdown /r /t 0” /sc once /st 12:00:00 /sd 19/10/2025 /ru “System”


43 Free Stock images sites

  1. Pexels
  2. Unplash
  3. Pixabay
  4. Magdeleine
  5. Burst
  6. Reshot
  7. Gratisography
  8. ISO Republic Photos
  9. VisualHunt
  10. FreePhotos
  11. Negative Space
  12. Picography
  13. Kaboompics
  14. Picjumbo
  15. StockSnap
  16. LibreShot
  17. Jay Mantri
  18. Bara-Art
  19. BarnImages
  20. Freely Photos
  21. Good Stock Photos
  22. Foca Stock – Photos
  23. Free nature Stock – Photos
  24. SkitterPhoto
  25. Altphotos
  26. Nappy
  27. Slon Pics
  28. Scatter Jar
  29. Picmelon
  30. iwaria
  31. Glyphs – Photos
  32. FoodiesFeed
  33. Shutteroo
  34. Picspree
  35. The Pic Pac
  36. Realistic Shots
  37. Stokpic
  38. Startup Stock Photos
  39. DesignersPics
  40. Wunder Stock
  41. Cupcake
  42. Pxfuel
  43. Good Free Photos


Reset IIS Application Pool Remotely in PowerShell

$password = “yourpassword”
$username = “yourusername”
Write-Host “Start reset”

$SecurePassword = $password | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $SecurePassword
$Session = New-PSSession -ComputerName $server -Credential $cred

Invoke-Command -Session $Session -ScriptBlock {
Restart-WebAppPool YourAppPoolName
Write-EventLog -LogName Application -Source MyScript -EventId 3001 -Message “AppPool restart was called from remote”

Write-Host “Reset done”

Uncategorized Windows

Umbraco Continuous Deployment with Jenkins

I haven’t seen many posts about Continuous Integration. Perhaps this is because Umbraco Cloud option offers this feature off the shelf but I have some customers that require customizations (custom databases) that would be costly on the Umbraco Cloud setup. Therefore I decided to spin up Jenkins that connects to Github repo and does automatic deployment from the main branch whenever there is push to it.

Here are few quick steps that gets you started.

1. Setup Github

Wheater you use Github or Gitlab or your own Git repo these steps do not matter. You just need a branching stradegy where the master branch matches what is in your live site.

image of release branch workflows

Merge feature branches into the master branch using pull requests.

Install Jenkins

I have root server Windows 2019 running on Hetzner but I hear OVHCloud is good as well. So, I installed Jenkins instances directly on my test server and live server. I could do the setup with PowerShell remote but Jenkins is quick to install and requires very little maintainance and resources so I just have them running isolated on the given server.

In the Jenkins server you also need Microsoft Build Tools and Nuget installed on globally available.

Configure Jenkins for Umbraco

You need some plugins in order to build .NET projects and Frontend projects. Try these:

  • MBBuild
  • Global Slack Notifier Plugin (for notifying build success/failures)
  • NodeJS Plugin (control npm builds)
  • Nuget Plugin
  • PowerShell plugin (for scripting)
  • ThinBackup (for moving Jenkins configs between instances

Here is my sample configuration on Freestyle Jenkins project.

Node version

Nuget restore command and Injection to Assembly

Run MSBuild

Copy files from Jenkins build folder to Webroot

Notice that running IISReset here is probably not the best idea. I have done same thing on Sitecore projects where instead I stop/start Application Pool. Stop-WebAppPool -Name "DefaultAppPool" you may make restarting of the application few seconds faster that way. But you need to stop AppPool or IIS because sometiimes artificats are locked and if that happens things goes south.

Post Build actions

You can also setup here Email notification or if you use Teams , RocketChat etc. there is plugins for sending notification when build completes or fails.
If you work on bigger team you can also send email for whoever pushed bad code on the success/failure.

That’s it. Minimail Jenkins setup for Umbraco projects that I use. This same setup works for any .NET projects as I did not include any actions on uSync or anything other Umbraco specific.

I have done few DevOps Setups on Jenkins, TeamCity, Azure Devops and Github Actions. Which ever CI/CD tool you are using I recommend to create your scriptinigs on Node and/or PowerShell so you can easily jump between as they all work essentially same way.


Quick Screen -command reference

Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).


Start a new session with session name
screen -S <session_name>
List running sessions / screensscreen -ls
Attach to a running sessionscreen -x
Attach to a running session with namescreen -r <session_name>
Detach a running sessionscreen -d <session_name>

Switching between screens

When you do nested screen, you can switch between screen using command “Ctrl-A” and “n“. It will be move to the next screen. When you need to go to the previous screen, just press “Ctrl-A” and “p“.

To create a new screen window, just press “Ctrl-A” and “c“.

Leaving Screen

There are 2 (two) ways to leaving the screen. First, we are using “Ctrl-A” and “d” to detach the screen. Second, we can use the exit command to terminating screen. You also can use “Ctrl-A” and “K” to kill the screen.

That’s some of screen usage on daily basis. There are still a lot of features inside the screen command. You may see screen man page for more detail or this page


I don’t use anymore “cloud” providers for personal projects.

I love Azure Functions for small jobs and deploying Kubernetes cluster from Github actions to Amazon EKS is blast. But I think it is only business customers and not for small startups or pet projects.

At work I am using Azure and AWS and I used to have GCP and AWS for my pet projects as well but now my projects run on Hetzner VPS’s and Cloud. Main reason for my decision to favour Hetzner over these big guys is uncertaincy and confusion of billing. It’s nice if I suddenly become next Facebook to have scaling possibilty but that is least of my worries and quite nice problem to have. What I like VPS’s and Hetzner Cloud is straight forward and simple pricing per month. If I want Cloud instance with 2Gb RAM and 1vCPU it’s 3 Euros. If I run out of resources I can scale up like going to 32Gb is 35 Euros.

I have small startup where I have worker process written on Python, API written on Node and client running as SPA (Vue.js/Nuxt.js). Data layer is on PostgreSQL/Redis. Without thinking, I set this up in AWS and it worked nicely but soon I noticed this is 100 Euros/month. Since this is in Minimum Viable Product stage I decided to move to VPS. So I spin up VPS with Ubuntu on it. I deployed everything there and changed Github actions. It took me one evening and I don’t consider myself sysadmin. But I think installing Linux with above tech stack is easier than to understand how to run same setup on AWS, GCP or Azure. If in some point I need scaling I can always move back Kubernetes setup on AWS but sometimes less is more.


Prevent IIS indexing test enviroment

Sometimes you may have publicly facing website, which you don’t want it indexed by the major search engines. Easy way is to add robots.txt or meta tags on html but more global setting can be set on IIS settings from ‘Administrative Tools’ open ‘Internet Information Services (IIS) Manager’ > Select the Server > ‘HTTP Response Headers’.

‘Administrative Tools’ open ‘Internet Information Services (IIS) Manager’ > Select the Server > ‘HTTP Response Headers’.

Once dialog for HTTP Response Header is open

Add  > Name = X-Robots-Tag > Value = noindex > and press OK.

General info about X-Robots-Tag HTTP header

The X-Robots-Tag can be used as an element of the HTTP header response for a given URL. Any directive that can be used in a robots meta tag can also be specified as an X-Robots-Tag. Here’s an example of an HTTP response with an X-Robots-Tag instructing crawlers not to index a page:

About Robots Tag

A meta robots tag can include the following values:

  • Index: Allows search engines to add the page to their index.
  • Noindex: Disallows search engines from adding a page to their index and disallows it from appearing in search results for that specific search engine.
  • Follow: Instructs search engines to follow links on a page, so that the crawl can find other pages
  • Nofollow: Instructs search engines to not follow links on a page.
  • None: This is a shortcut for noindex, nofollow.
  • All: This is a shortcut for index, follow.
  • Noimageindex: Disallows search engines from indexing images on a page (images can still be indexed using the meta robots tag, though, if they are to linked to from another site).
  • Noarchive: Tells search engines to not show a cached version of a page.
  • Nocache: This is the same as noarchive tag, but specific to the Bingbot/MSNbot.
  • Nosnippet: Instructs search engines to not display text or video snippets.
  • Notranslate: Instructs search engines to not show translations of a page in SERPs.
  • Unavailable_after: Tells search engines a specific day and time that they should not display a result in their index.
  • Noyaca: Instructs Yandex crawler bots to not use page descriptions in results.

Read more at Google Robots meta tag, data-nosnippet, and X-Robots-Tag specifications