Install wordpress

Hello I’m french and I installed wordpress on my freedombox this way because I already know a little and there are a lot of tutorials. If there is a problem because dangerous, I delete the post.
prepare apache2
sudo apt install php libapache2-mod-php mariadb-server php-mysql
restart
sudo systemctl restart apache2
prepare mariadb
sudo mysql_secure_installation

  • enter Enter
  • enter Yes
  • enter NEW PASSWORD
  • confirm NEW PASSWORD
  • enter Yes
  • enter Yes
  • enter Yes
  • enter Yes

create database wordpress
sudo mysql
CREATE DATABASE wordpress;
GRANT ALL PRIVILEGES ON wordpress.* TO 'USER'@'localhost' IDENTIFIED BY 'PASSWORD';
adapt USER and PASSWORD
FLUSH PRIVILEGES;
QUIT;
prepare wordpress
sudo apt install unzip
wget https://fr.wordpress.org/wordpress-latest.zip
sudo unzip wordpress-latest.zip -d /var/www/html
sudo chown www-data:www-data /var/www/html/wordpress -R
sudo chmod -R -wx,u+rwX,g+rX,o+rX /var/www/html/wordpress
set up apache2
sudo nano /etc/apache2/sites-available/010-wordpress.conf

<VirtualHost *:80>

        ServerName wordpress
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html/wordpress
        <Directory /var/www/html/wordpress>
            Options FollowSymLinks
            AllowOverride all
            Require all granted
        </Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

sudo nano /etc/apache2/apache2.conf

add at the end

<Directory /var/www/html/wordpress>
       AllowOverride All 
</Directory>

sudo a2dissite 000-default.conf
sudo a2ensite 010-wordpress.conf
sudo systemctl reload apache2

cordially

Hallo, I followed your instructions but I apache2 gives an error message

Debian Buster, PHP 7.4.7, MariaDB 10.5, WP 5.4.2

I guess error is related to file permissions but I am not sure.

Only exposing the output of a static site generator should be much more secure for a freedombox that contains user data and is located in the local network (e.g. https://salsa.debian.org/freedombox-team/freedombox/-/issues/1323). Wasn’t wordpress sending out too much of user data to “spam” checkin services anyway?

I posted this to a thread of my own, but I’m wondering if it would be helpful here. This was my own hacky way of getting WordPress to act as the root website on my FBX install. I know how to make WP work, but I’m not familiar with FBX enough to recommend doing it this way on a production system.

From my notes on making WP work as default www page.

That’s actually something I wanted to bring up with someone more knowledgeable than I am…I made WP work by editing config files without knowing exactly what else that would affect.

  1. I installed apache-mariadb-php using the instructions here: https://www.linuxbabe.com/debian/install-lamp-stack-debian-10-buster, including the mysql_secure_installation piece.
  • Before you do this, try taking a snapshot of the /etc/apache2/ directory. The install disables some of the configs and vhosts, causing FBX to lose functionality. So make sure you know what’s already configured.

  • After the install, check /etc/apache2/sites-enabled, mods-enabled, and confs-enabled to ensure that everything that was there before is still there. If not, use sudo a2ensite, a2enmod, and a2enconf to make it match.

  • Before restarting Apache, edit the default vhost site config (000-default.conf) and point the document root directive to your wordpress directory. Here is my working VirtualHost *:80 config:

     ServerName www.meetingvite.com
    
     ServerAdmin webmaster@localhost
     DocumentRoot /var/www/html
     DirectoryIndex index.php index.html
    
     <Directory "/var/www/html">
             Options FollowSymlinks
             AllowOverride All
     </Directory>
    
  1. Edit the file /etc/apache2/conf-available/freedombox-apache-homepage.conf and comment out the first line, RedirectMatch "^/$" "/index.html" with two hashtags like this: ## RedirectMatch "^/$" "/index.html". You have to comment it instead of using a2disconf on the whole config or FBX fixes itself and makes /plinth your default site.
  2. Now restart apache with sudo systemctl apache2 reload.
  3. It’s super helpful to change the owner/group of the WP html directory and its contents to www-data. WP will help you add and edit files in your installation if it has filesystem access with write permissions.
  4. You’ll need to install the Apache library for Certbot and get a cert using the command line. I found instructions on the EFF site, but they only work if you change the python version to 3 like this:
    sudo apt-get install certbot python3-certbot-apache
  • Then run:
    sudo certbot --apache
    and it will pick up your new domain as a candidate for requesting a certificate. You can’t use the built-in Certbot UI from FBX.
  • This also creates the apache2 site conf file for port 443.

I’ve pulled these directions from my notes, so I may have left out some minor details. Let me know if you run into any trouble. Configuring WP to run in just about any server setup is my thing, so I’m sure I can help.