How to forcefully restart iPhone 11 Pro Max

On the older iPhones with Touch ID you’d have to hold down both the Sleep/Wake button and the Home button. On the newer Face ID devices this can be a bit different.

You might notice if you try Volume + Sleep, that it wants to shut down or even call emergency services. So that’s not the way.

Okay, for the iPhone 11 Pro Max, follow these steps.

  • Press Volume-Up button once.
  • Press Volume-Down button once.
  • Press and hold the Sleep/Wake button, and keep holding until you see the Apple logo appear.

This should work on all iPhone X and iPhone 11 devices by the way.

When do you need this? Almost never. The iPhone 11 doesn’t require a shutdown, restart, etc. The iOS upgrades will take care of everything. You can use App Switcher to shutdown apps as well. Maintenance to phone is; Turn it on, use it, don’t worry about shutting it down and all that.

But every once in a while if some glitchy behavior shows up on-line articles might recommend to at least try a force restart. And then this is how you do that. Up/Down, and then hold Sleep until Apple logo.

The official method recommended by Apple is to hold the Sleep-button and swipe the Shutdown and let it shut down. Then hold Sleep until the Apple logo shows up. But what if your screen isn’t even responsive anymore? And in that case this trick works, because you’re literally only using hardware buttons to achieve a restart (and it’s actually quite a bit faster as well)



Ubuntu 18 : How to import a MySQL .sql database

ssh to your server with a user that can sudo up, and have your details ready, and change to the directory where the .sql dump is located. Of course, maybe make a new database in the mysql server, so you don’t accidentally override anything.

mysql -u dbusername -p dbname < file.sql

The dbusername is the mysql username that has permissions to use the database.

The dbname is the mysql database that is available for that user to connect to, once the password is provided.

The file.sql is the database filename that you wish to import

The -p should not be populated, it will prompt you to enter the password.


How to make a tarball backup of public_html

There’s a lot of different (type) of files in the public_html directory of your web server. You should manually back this up, and back it up properly.

I recommend using tar, it can gzip it for you. And it can respect the permissions and relative path. It’s an easy tarball as they call it, that you can upload, download, share between servers. Very handy for testing, cloning, backing up etc.

Note: If you have a MySQL database (or more) used by your website, of course back those up separately.

sudo tar -cvpzf /home/user/backups/description-timestamp-www.tar.gz -C /var/www/ public_html

Adjust the paths to your personal setup.



Ubuntu 18 : PHP Allow bigger file uploads

I found that the default is 2 megabyte with post upload limit of 8 megs. This is not enough these days anymore.

I found in Ubuntu 18 with PHP 7.2, that I have my php.ini file to reside here: /etc/php/7.2/apache2

Edit it:

sudo nano -w /etc/php/7.2/apache2/php.ini

And find:

post_max_size = 8M

Change this to a higher value like 16M

Then find:

upload_max_filesize = 2M

Change this to a higher value like 8M or 12M

The values depend on your server hardware, and what you wish to upload to your sites.

Then restart the web server:

sudo service apache2 restart

XenForo : How to get Friendly URL to work

If you don’t use managed hosting solutions for your forums, you might have to install everything yourself.

By default the directive for AllowOverride is set to None, meaning even if you enable the friendly urls in XenForo, it will show you 404 not found pages.

Step 1.

If you already have a .htaccess file, get the appropriate content from htaccess.txt provided by XenForo and apply it properly to your existing .htaccess file.

Otherwise, rename htaccess.txt to .htaccess.

Make sure your .htaccess file for XenForo is in the public html directory from where you run XenForo.

Step 2.

Edit the .htaccess file, and find the commented #RewriteBase /xenforo line and change it to:

RewriteBase /

Step 3.

Make sure your Apache2 web server has mod_rewrite installed. Ssh to the server with a user that can sudo up, and type:

sudo a2enmod rewrite

Step 4.

Find your apache.conf in /etc/apache2/ and edit it with nano, finding the directive for /var/www, and change None to All.

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted

And finally, restart apache:

sudo service apache2 restart



Ubuntu 18 : How to install phpmyadmin and secure phpmyadmin

Once you have https configured on your server, and you have a MySQL server installed, it might be desirable to install phpmyadmin, this is a php web interface solution to help you manage your mysql databases, users, etc.

For security reasons: don’t install it. If you do wish to install it, continue reading, but take some security precautions.

Make sure your server is up to date, you can apt update, and apt upgrade first, then:

sudo apt install phpmyadmin php-mbstring php-gettext

Make sure to select Apache from the list, press ok, give it a password for phpmyadmin, and let the installation complete.

Then type:

sudo phpenmod mbstring

And now restart the web server:

sudo service apache2 restart

Next, we have to add user authentification, and work on the security a little bit.

Note: In a previous blog we’ve changed the way root can use mysql, the auth_socket got changed to mysql_native_passowrd, we assume that’s the case.

Login to your mysql server:

mysql -u root -p

Give it your mysql root password, and then add a phpmyadmin user, I will go with phpmyuser

CREATE USER 'phpmyuser'@'localhost' IDENTIFIED BY 'password';

And then grant it the correct permissions:


Next, update the changes and exit.


Next, let’s work on the security, phpmyadmin is a target, so it’s smart to add an extra layer of security with .htaccess directive.

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

Append allowoverride directive:

AllowOverride All

It should look like this:

<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All

And restart apache again,

sudo service apache2 restart

Now we have to actually create this .htaccess file, and then generate the .htpasswd file:

sudo nano /usr/share/phpmyadmin/.htaccess


AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/phpmyadmin/.htpasswd
Require valid-user

And then after saving that type:

sudo htpasswd -c /etc/phpmyadmin/.htpasswd phpmyadmin

Give it a password, repeat it.

This means, when you browse to the site for phpmyadmin, it will popup a login box, the user/pass combo is what we’ve just created. It’s separate from the mysql user/pass we’ve created earlier, which it will prompt right after.

And we’re done, you can now go to your domain, and type: phpmyadmin, right behind it, and it should work:



Ubuntu 18 : How to install Let’s Encrypt (Add https to your site)

If you’ve finished setting up your LAMP setup, it’s important to encrypt the traffic over https, we do this with a free solution called Let’s Encrypt. Because why pay unless you’re an Enterprise..

ssh into the server with a user that can sudo up, and type:

sudo apt install python-certbot-apache

Follow the on-screen instructions.

Note: Make sure at or whatever registrar you use for your domains, that you have a proper IN A record set that points the domain @ to the IP. And for www. optionally.

If you use ufw, make sure you add port 443 to the list.

ufw allow 443

And then go and use certbot to create a certificate for each domain as setup in virtual hosts configuration files.

sudo certbot --apache -d -d

And that’s basically it.


Ubuntu 18 : How to add Virtual Hosts to Apache2

Assuming you’ve properly installed Apache2, MySQL, PHP, and read some of the other blogs I’ve written, it’s time to add domains that point to the IP of the server, to the Apache2 as virtual hosts. This makes it easier to add files to load, per domain, even if you have multiple domains on the same IP on the server.

Add the directories for the sites we want to add:

sudo mkdir -p /var/www/
sudo mkdir -p /var/www/
sudo mkdir -p /var/www/

Next, change the owner to the current user, and the group, this way you can sftp in later and upload the files, manage your site, etc:

sudo chown -R $USER:$USER /var/www/
sudo chown -R $USER:$USER /var/www/
sudo chown -R $USER:$USER /var/www/

And setup the correct permissions for the www directory, recursively:

sudo chmod -R 755 /var/www

Some default data, making it easier to visually identify where we are. You can enter whatever data you want in there:

nano /var/www/
nano /var/www/
nano /var/www/

Creating virtual host files is next, first I copy the default apache config, then I customize it to point the ServerName and ServerAlias to the right domain.

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/
sudo nano /etc/apache2/sites-available/

Then I copy this for the next domain name, like beta or dev:

sudo cp /etc/apache2/sites-available/ /etc/apache2/sites-available/
sudo nano /etc/apache2/sites-available/

sudo cp /etc/apache2/sites-available/ /etc/apache2/sites-available/
sudo nano /etc/apache2/sites-available/

Enable the virtual hosts we’ve created:

sudo a2ensite
sudo a2ensite
sudo a2ensite

Optionally, you can disable the default configuration; but I always leave it as a fallback:

sudo a2dissite 000-default.conf

Don’t forget to restart Apache2’s service:

sudo service apache2 restart

Pro tip; you can update your hosts file on your computer to point the ip to the domains, then restart the browser and surf to the domain names. They should now individually work, with the data you’ve set in the index.php file.

Here’s an example configuration file:

<VirtualHost *:80>
    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

Ubuntu 18 : Install PHP

Assuming you’re going for a LAMP setup, which is Linux, Apache, MySQL and PHP, and have followed some of my other blog posts, we’re at the point where you might find out that PHP isn’t installed on Ubuntu 18 on most hosting solutions. Hopefully this quick guide will get you started.

sudo apt install php libapache2-mod-php php-mysql

Follow the on-screen instructions, accept Y for yes when asked to install additional stuff.

Next, we wish to give priority to loading index.php over index.html, so edit the following file with nano, and in front of index.html type index.php, then go further down the line and remove index.php from the list there.

sudo nano /etc/apache2/mods-enabled/dir.conf

It should look like this probably:

<IfModule mod_dir.c>
       DirectoryIndex index.php index.html index.cgi index.xhtml index.htm

If you run XenForo or something else, you might wish to install additional required modules:

sudo apt install php-cli php-curl php-gd php-xml php-zip

Don’t forget to restart the Apache2 web server to get everything started.

sudo service apache2 restart



Ubuntu 18 : Add MySQL database and user

After installing the MySQL server and setting it all up as per this blog post:, it’s time to add a database, and a user to this database.

Assuming you’ve followed the previous blog post, connect to the mysql server with the mysql root user as such:

mysql -u root -p

It will look like this:

floris@server:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.

Let’s first add a database that our user can use.

CREATE DATABASE database_name;

You can see it in the list:


Note: if you ever need to delete a database, it’s: DROP DATABASE IF EXISTS database😉

Okay, that’s all. Let’s add a user, now you COULD use this, and go through it all step by step, but I will show you how to add a user using the grant command. Since it will add the user anyway. So instead of this:

CREATE USER username IDENTIFIED BY 'password';

You can use this instead:

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';

And that’s it. Next we want to flush and exit:






Ubuntu 18 : How to install MySQL server

By default Ubuntu 18 usually has the Apache2 server installed, but the MySQL server might not be there. We will require it for and other websites. So we’re going to install it.

ssh to the server, login with a user that can sudo up, and type from the command line:

sudo apt install mysql-server

Follow the on-screen instructions, accepting Y if it wants to install additional things.

Once it’s successfully done. You aren’t. You have to do some basics, such as set a password, remove the test database, and remove the guest user.

To configure the MySQL server the easiest way, type:

sudo mysql_secure_installation

Then follow the on-screen instructions carefully.

Please realise the mysql ‘root’ user is not the same as the server’s root user, and you should pick a completely different password.

floris@server:~$ sudo mysql_secure_installation

Securing the MySQL server deployment.
Connecting to MySQL using a blank password.

VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password
and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin?
Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:
LOW Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary file
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 2
Please set the password for root here.

New password: (pick something matching your policy)
Re-enter new password: (repeat it)

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
- Removing privileges on test database...

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y

All done!

I hope this information helps you quickly setup mysql server on your Ubuntu 18 server.

In the next blog post I will walk through adding a new database, and a new user to this database.

To check if MySQL installed properly, you can type:

which mysql
mysql --version

It should look something like this:

floris@server:~$ which mysql
floris@server:~$ mysql --version
mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) 

Please note that on Ubuntu 18 you probably don’t have to do this (Debian based), but just in case, you might as well type this to initialize the mysql data directory:

sudo mysqld --initialize

It will probably error like this, that’s fine. This just means it’s already there.

floris@server:~$ sudo mysqld --initialize
2020-08-17T07:55:29.266639Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2020-08-17T07:55:29.266708Z 0 [ERROR] Aborting

The last step before we (can) start adding using the MySQL server is to change the authentification type from auth_socket to msyql_native_password. To achieve this, connect to the mysql server.

Note: You will notice it will automatically log you in, that’s one of the things we wish to change.

sudo mysql

and then query the server to show how it’s setup:

SELECT user,authentication_string,plugin,host FROM mysql.user;

Output should look like this:

floris@server:~$ sudo mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.31-0ubuntu0.18.04.1 (Ubuntu)

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
| user | authentication_string | plugin | host |
| root | | auth_socket | localhost |
| mysql.session | *x | mysql_native_password | localhost |
| mysql.sys | *x | mysql_native_password | localhost |
| debian-sys-maint | *x | mysql_native_password | localhost |
4 rows in set (0.00 sec)


Now run this query, and replace ‘password’ at the end with your mysql root password. If you pick a new pass here, it will change it of course.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'p4ssw0rd-change-me';

Then finally before typing exit, type:


And you’re done, you can type this again to see if it changed:

SELECT user,authentication_string,plugin,host FROM mysql.user;

But you’re done, you can type exit now.

mysql> exit

Instead of connecting to the MySQL server with just ‘mysql’, you now type this to connect (and don’t include the password, provide it when asked for)

mysql -u root -p

You’re now ready to add one or more databases, and then users to that database. But I will cover that in another blog post.

Note: If you try mysql from cli, it should error like this:

root@server:~# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)



Ubuntu 18 : How to add basic firewall with ufw

It should be installed by default on Ubuntu, but some virtualization images etc might not have it.

Login with ssh to your server, with a sudo abled user and install ufw

sudo apt install ufw

Note: It’s important you stay logged in while you sort this out, and that you don’t restart the server, or enable the firewall etc, until we’re done. You don’t want to lock yourself out.

Note: If you have not changed your ssh port, allow port 22, otherwise allow your custom port.

Before we do anything, let’s reset some basic rules:

sudo ufw default deny incoming
sudo ufw default allow outgoing

And now let’s first add the ssh port, for example, 22 or the custom port like 22555

sudo ufw allow 22
sudo ufw allow 22555

Additional services like 80 and 443 for web servers, or 25565 for Minecraft, might be handy to add now as well.

sudo ufw allow 80
sudo ufw allow 443

Next, since you’ve added your ssh port (go double check!) you can enable the firewall:

sudo ufw enable

If you get kicked out and can’t get back in, most servers have a control panel through the host. You can use the serial console there with a root user, to disable and reset the firewall.

sudo ufw disable
sudo ufw reset

Hopefully you don’t need that.