This guide installs Froxlor with Apache/Nginx, PHP, and MariaDB.
- name: Install Froxlor on Debian and RHEL families
hosts: froxlor_servers
become: true
vars:
froxlor_web_root: /var/www/html # Default Apache document root
froxlor_db_name: froxlor
froxlor_db_user: froxlor
froxlor_db_password: change-me-db
tasks:
- name: Install dependencies (Debian/Ubuntu)
ansible.builtin.apt:
update_cache: true
name:
- apache2
- libapache2-mod-php
- ssl-cert # For HTTPS support
- mariadb-server
- php
- php-mysql
- php-xml
- php-mbstring
- php-curl
- php-gd
- php-intl
- git
- curl
- wget
state: present
when: ansible_os_family == "Debian"
- name: Install dependencies (RHEL/CentOS/Rocky Linux)
ansible.builtin.dnf:
name:
- httpd
- php
- php-mysqlnd
- php-xml
- php-mbstring
- php-curl
- php-gd
- php-intl
- mod_ssl # For HTTPS support
- git
- curl
- wget
- policycoreutils-python-utils # For SELinux management
state: present
when: ansible_os_family == "RedHat"
- name: Ensure Apache headers module is available (RHEL/CentOS)
ansible.builtin.lineinfile:
path: /etc/httpd/conf.modules.d/00-base.conf
line: LoadModule headers_module modules/mod_headers.so
create: yes
notify: restart httpd
when: ansible_os_family == "RedHat"
- name: Clone Froxlor source
ansible.builtin.git:
repo: https://github.com/Froxlor/Froxlor.git
dest: "{{ froxlor_web_root }}"
version: master
force: false
- name: Set ownership (Debian/Ubuntu)
ansible.builtin.file:
path: "{{ froxlor_web_root }}"
state: directory
recurse: true
owner: www-data
group: www-data
when: ansible_os_family == "Debian"
- name: Set ownership (RHEL/CentOS/Rocky Linux)
ansible.builtin.file:
path: "{{ froxlor_web_root }}"
state: directory
recurse: true
owner: apache
group: apache
when: ansible_os_family == "RedHat"
- name: Create Froxlor database
community.mysql.mysql_db:
name: "{{ froxlor_db_name }}"
state: present
- name: Create Froxlor database user
community.mysql.mysql_user:
name: "{{ froxlor_db_user }}"
password: "{{ froxlor_db_password }}"
priv: "{{ froxlor_db_name }}.*:ALL"
host: localhost
state: present
- name: Enable Apache modules (Debian/Ubuntu)
ansible.builtin.shell: a2enmod rewrite && a2enmod headers
args:
creates: /etc/apache2/mods-enabled/rewrite.load
when: ansible_os_family == "Debian"
- name: Create Apache virtual host for Froxlor (Debian/Ubuntu)
ansible.builtin.copy:
content: |
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
DirectoryIndex index.php
</Directory>
# Security headers
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options DENY
Header always set X-XSS-Protection "1; mode=block"
ErrorLog ${APACHE_LOG_DIR}/froxlor_error.log
CustomLog ${APACHE_LOG_DIR}/froxlor_access.log combined
</VirtualHost>
dest: /etc/apache2/sites-available/froxlor.conf
notify: restart apache2
when: ansible_os_family == "Debian"
- name: Enable Froxlor virtual host (Debian/Ubuntu)
ansible.builtin.shell: a2ensite froxlor
args:
creates: /etc/apache2/sites-enabled/froxlor.conf
notify: restart apache2
when: ansible_os_family == "Debian"
- name: Create Apache virtual host for Froxlor (RHEL/CentOS/Rocky Linux)
ansible.builtin.copy:
content: |
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
DirectoryIndex index.php
</Directory>
# Security headers (requires mod_headers)
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options DENY
Header always set X-XSS-Protection "1; mode=block"
ErrorLog /var/log/httpd/froxlor_error.log
CustomLog /var/log/httpd/froxlor_access.log combined
</VirtualHost>
dest: /etc/httpd/conf.d/froxlor.conf
notify: restart httpd
when: ansible_os_family == "RedHat"
- name: Configure SELinux (if enabled on RHEL systems)
ansible.builtin.command: setsebool -P httpd_can_network_connect 1
when:
- ansible_os_family == "RedHat"
- ansible_selinux is defined
- ansible_selinux.status == "enabled"
- name: Enable and start services (Debian/Ubuntu)
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
loop:
- apache2
- mariadb
when: ansible_os_family == "Debian"
- name: Enable and start services (RHEL/CentOS/Rocky Linux)
ansible.builtin.systemd:
name: "{{ item }}"
enabled: true
state: started
loop:
- httpd
- mariadb
when: ansible_os_family == "RedHat"
- name: Wait for Apache to start
ansible.builtin.wait_for:
port: 80
delay: 5
timeout: 30
handlers:
- name: restart apache2
ansible.builtin.systemd:
name: apache2
state: restarted
- name: restart httpd
ansible.builtin.systemd:
name: httpd
state: restarted
ansible-playbook -i inventory.ini froxlor-install.yml
After running the playbook, you need to complete the Froxlor installation through the web interface:
Open your web browser and navigate to:
http://your-server-ip orhttp://your-domain.comYou should see the Froxlor welcome screen. If you encounter a 404 error, ensure Apache is running and the virtual host is properly configured.
localhostfroxlor (or whatever you set in froxlor_db_name)froxlor (or whatever you set in froxlor_db_user)change-me-db (or whatever you set in froxlor_db_password)Create your administrator account:
http://your-server-ip (Froxlor will redirect to the setup process or login page)After logging in, you should:
/var/www/html on both Debian and RHEL systems (the default Apache document root)froxlor_debian.sudo systemctl status apache2 (Debian) or sudo systemctl status httpd (RHEL)sudo chown -R www-data:www-data /var/www/html (Debian) or sudo chown -R apache:apache /var/www/html (RHEL)sudo mysql -u froxlor -p (using your database password)sudo tail -f /var/log/apache2/error.log (Debian) or sudo tail -f /var/log/httpd/error_log (RHEL)sudo a2ensite froxlor (Debian) or check /etc/httpd/conf.d/froxlor.conf (RHEL)Beyond this playbook, we offer:
Contact our automation team: office@linux-server-admin.com