A working Apache2 server with PHP7.4

I was in need of a server solution that could be quickly deployed as a VM.

      1. Install Debian 11 as a VM with web- and SSH server
      2. Create a USER next to your root account during the installation
      3. Find the IP address of the new installation. The easiest is if you have NoVNC running. Log in as USER and type
        ip a
      4. Time to so the sudo thing
        su

        log in as root

        apt-get update && apt-get install -y sudo
        usermod -aG sudo USER
        exit
        exit

        log back in as USER

      5. Okay, let’s install some more stuff but first we do an update
        sudo apt-get update && sudo apt-get upgrade -y

        Now we want some essentials

        sudo apt-get install -y dirmngr gnupg2 nano wget gpg curl fail2ban ufw software-properties-common

        Preparing the PHP install

        wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
        echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
        sudo apt-get update
        sudo apt-get install -y php7.4 libapache2-mod-php7.4 php7.4-mysql php7.4-curl php7.4-gd php7.4-mbstring php7.4-xml php7.4-xmlrpc php7.4-zip

        And restart the Apache2 Webserver

        sudo systemctl restart apache2
      6. Alright, that’s done. Next step is to test things.
        sudo nano /var/www/html/test.php

        Enter this into the php file and press Control X and type Y to save and exit.

        <?php
        // Show all PHP information
        phpinfo();
        ?>
      7. Go to the IP address of the server you just created and type
        HTTP://IP ADDRESS/test.php
        

        If you see a PHP page with all sorts of data, you’re good. If not, go fix. Don’t ask me, I’m not there yet!

Adding and removing a user in PLIK

ADD A USER
Open the UNraid console and enter

./plikd --config ./plikd.cfg user create --login USERNAME --name Admin --admin

The result should be as follows:

Generated password for user controller is yH7ggwod473A3xM5BdI8wEz2FM7bcqF1

REMOVE A USER

Find the user:

./plikd user list

You should see:

local:USERNAME Admin

To remove user, enter:

./plikd --config ./plikd.cfg user delete --login USERNAME Admin

ArchiveBox root issue in UNraid [FIXED]

Short version of:

Archivebox Docker superuser root issues

[!] ArchiveBox should never be run as root!

The INIT line is in case you set up this docker for the first time. If you already have entered the INIT command, I don;t think you have to do it again.

  1. Open the UNraid Terminal
  2. Enter
    cd /data
  3. Enter (Optional, see previous note)
    archivebox init
  4. Enter
    docker exec -it --user archivebox archivebox bash
  5. Enter
    archivebox manage createsuperuser

Done!

Credits to “emiliobool” for their comment on April 25, 2021 @ https://github.com/ArchiveBox/ArchiveBox/issues/395

 

Keeping your data while restarting Joomla Docker in unRAID

Finally, there is an official Joomla (4.x) Docker made for unRAID. But it is not done well. As in, you will lose all your settings and data when you restart your docker. So you need to copy the data outside the docker into the appdata folder. (Or wherever you want it)

Inside the docker image, the Joomla folder resides here:

/var/www/html/

And this is the folder you need to make “external” by adding a path to the edit/install panel.

  1. Give it a name at “Name:”
  2. Enter the following line to “Container Path:”
    /var/www/html
  3. Enter the following line to “Host Path:”
    /mnt/user/appdata/joomla-data/

Done.

How to fix “Maintenance Mode” in NextCloud

Super annoying when you get locked out, innit?

It depends a bit how you have installed NextCloud but here are two possible locations for your config file:

/var/www/htdocs/nextcloud/config/config.php 
("regular" apache install)
/config/www/nextcloud/config/config.php
(when using a Docker install)

Open the config.php file and look for

 'maintenance' => true,

And change this to

 'maintenance' => false,

Done.

Install Group Policy Editor (gpedit.msc)

  1. Open command prompt with admin rights
  2. Enter the following one after the other and the software has been installed.
    1. FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~*.mum") DO (DISM /Online /NoRestart /Add-Package:"%F")
    2. FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~*.mum") DO (DISM /Online /NoRestart /Add-Package:"%F")

New FTP user for unRAID

  1. Install ProFTPd by SirG
  2. Create folder where the FTP user should have FULL access to
  3. Go to USERS tab
  4. Click ADD USER
  5. Create username
  6. Create password
  7. In the DESCRIPTION field enterftpuser [PATH WITH LEADING SLASH]
    So for example:
    ftpuser /mnt/usr/myfolder
  8. Click ADD
  9. Go to SETTINGS tab
  10. Click ProFTPd
  11. At “Enable ProFTPd:” select YES (*)
  12. Click APPLY
  13. Service should be running. If not, start service
  14. DONE

(*) In case you already have the service running, click RESTART to activate the new user.

The server can now be accessed by SFTP and port 22.

How to GIT

UPDATE

git pull

make new local branch:

git checkout -b [name]

CHANGES
make changes, then add all:

git add .

commit:

git commit -m "comment"

push changes and create new branch:

git push

TO GET THE LATEST VERSION

git checkout master
git pull
git checkout [USER]
git rebase master

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b [USER] origin/[USER]

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout origin/master
git merge --no-ff [USER]

Step 4. Push the result of the merge to GitLab

git push origin master

(In this case [USER] is foxsan. And you are not him.)