xibo_dev_env/web.sh

96 lines
2.6 KiB
Bash
Raw Normal View History

2023-09-26 10:06:12 +02:00
#!/bin/bash
# Installation des paquets
apt-get update
yes | apt-get install apache2 ufw php php7.4-gd php-common php-cli php-json php-dom php-mysql php-zip php-soap php-curl php-xml php-mbstring php-zmq libapache2-mod-wsgi-py3 libapache2-mod-xsendfile python-dev
# Installation Xibo cms
mkdir /srv/xibo-cms
cd /srv/xibo-cms
wget https://github.com/xibosignage/xibo-cms/releases/download/2.3.3/xibo-cms-2.3.3.tar.gz
tar -xvzf xibo-cms-2.3.3.tar.gz --strip-components=1
rm xibo-cms-2.3.3.tar.gz
chown -R www-data:www-data /srv/xibo-cms
rm -r /var/www
ln -s /srv/xibo-cms /var/www
a2enmod rewrite
a2enmod ssl
cat > /etc/apache2/sites-available/xibo-cms.conf << EOF
<VirtualHost *:80>
DocumentRoot "/var/www/web"
ServerName xibo.domain.com
XSendFile on
XSendFilePath /var/www/Library
<Directory "/var/www/web">
AllowOverride All
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/var/www/web"
ServerName xibo.domain.com
XSendFile on
XSendFilePath /var/www/Library
<Directory "/var/www/web">
AllowOverride All
Options Indexes FollowSymLinks MultiViews
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
EOF
a2dissite 000-default.conf
a2ensite xibo-cms.conf
sed -i -e "s/\(max_execution_time =\).*/\1 300/" \
-e "s/\(memory_limit =\).*/\1 256M/" \
-e "s/\(post_max_size =\).*/\1 2G/" \
-e "s/\(upload_max_filesize =\).*/\1 2G/" \
-e "/^;session.cookie_secure =/ csession.cookie_secure = Off" \
-e "s/\(session.cookie_httponly =\).*/\1 On/" \
-e "s/\(session.cookie_samesite =\).*/\1 Lax/" /etc/php/7.4/apache2/php.ini
cat > /srv/xibo-cms/vendor/xibosignage/xibo-xmr/bin/config.json << EOF
{
"listenOn": "tcp://127.0.0.1:50001",
"pubOn": ["tcp://127.0.0.1:1234"],
"debug": false
}
EOF
chown www-data:www-data /srv/xibo-cms/vendor/xibosignage/xibo-xmr/bin/config.json
cat > /etc/systemd/system/xibo-xmr.service << EOF
[Unit]
Description=Xibo XMR
After=network.target
[Service]
User=www-data
Group=www-data
ExecStart=/usr/bin/php /srv/xibo-cms/vendor/bin/xmr.phar
Restart=always
KillMode=process
RestartSec=1
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable xibo-xmr.service
systemctl start xibo-xmr.service
cat > /var/spool/cron/crontabs/www-data << EOF
{
* * * * * /usr/bin/php /srv/xibo-cms/bin/xtr.php
}
EOF
ufw allow ssh
ufw allow http
ufw allow https
ufw allow 1234/tcp
yes | ufw enable
systemctl restart apache2