Skip to content

Powered by Grav

Virtual Host

Create a dedicated directory for the Apache virtual host:

BASH
sudo mkdir -p /www
sudo mkdir -p /www/pixelfed.cogip.be
sudo chmod -R 755 /www

Create a new file

BASH
sudo nano /etc/apache2/sites-available/pixelfed.cogip.be.conf
APACHE
<VirtualHost *:80>
    ServerName pixelfed.cogip.be
    DocumentRoot /usr/share/webapps/pixelfed/public
    <Directory /usr/share/webapps/pixelfed/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/pixelfed-cogip-be.error.log
    CustomLog ${APACHE_LOG_DIR}/pixelfed-cogip-be.access.log combined

    # Real client IP and protocol
    RemoteIPHeader X-Forwarded-For
    RemoteIPTrustedProxy 192.168.0.80

    # Original scheme is HTTPS
    RequestHeader set X-Forwarded-Proto "https"
    RequestHeader set X-Forwarded-Ssl "on"

    # Send requests for PHP files to the PHP-FPM socket
    ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/run/php/pixelfed.sock|fcgi://localhost/usr/share/webapps/pixelfed/public/
</VirtualHost>

Enable the virtual host and disable the default Apache website:

BASH
sudo a2ensite pixelfed.cogip.be.conf
sudo a2dissite 000-default.conf

And restart Apache

BASH
sudo systemctl reload apache2

© 2026 howto.cogip.be. All rights reserved.