From 5c48de77795acfcdaca1b43d838a46e6db9e0159 Mon Sep 17 00:00:00 2001 From: drizzit56 <60116496+drizzit56@users.noreply.github.com> Date: Fri, 29 Oct 2021 00:29:46 +0100 Subject: [PATCH 1/2] Adding nginx alternative config file and updating INSTALL.md for nginx usage --- INSTALL/INSTALL.md | 36 +++++++++++++++---- ...ate_dev.conf => cerebrate_apache_dev.conf} | 0 INSTALL/cerebrate_nginx.conf | 0 3 files changed, 30 insertions(+), 6 deletions(-) rename INSTALL/{cerebrate_dev.conf => cerebrate_apache_dev.conf} (100%) mode change 100755 => 100644 create mode 100644 INSTALL/cerebrate_nginx.conf diff --git a/INSTALL/INSTALL.md b/INSTALL/INSTALL.md index 49948e8..3685b00 100644 --- a/INSTALL/INSTALL.md +++ b/INSTALL/INSTALL.md @@ -1,8 +1,9 @@ ## Requirements An Ubuntu server (18.04/20.04 should both work fine) - though other linux installations should work too. -- apache2, mysql/mariadb, sqlite need to be installed and running +- apache2 (or nginx), mysql/mariadb, sqlite need to be installed and running - php extensions for intl, mysql, sqlite3, mbstring, xml need to be installed and running +- php extention for curl (not required but makes composer run a little faster) - composer ## Network requirements @@ -17,8 +18,16 @@ Cerebrate communicates via HTTPS so in order to be able to connect to other cere ## Cerebrate installation instructions It should be sufficient to issue the following command to install the dependencies: + +- for apache + ```bash -sudo apt install apache2 mariadb-server git composer php-intl php-mbstring php-dom php-xml unzip php-ldap php-sqlite3 sqlite libapache2-mod-php php-mysql +sudo apt install apache2 mariadb-server git composer php-intl php-mbstring php-dom php-xml unzip php-ldap php-sqlite3 php-curl sqlite libapache2-mod-php php-mysql +``` + +- for nginx +```bash +sudo apt install nginx mariadb-server git composer php-intl php-mbstring php-dom php-xml unzip php-ldap php-sqlite3 sqlite php-fpm php-curl php-mysql ``` Clone this repository (for example into /var/www/cerebrate) @@ -73,7 +82,7 @@ sudo -u www-data cp -a /var/www/cerebrate/config/config.example.json /var/www/ce sudo -u www-data vim /var/www/cerebrate/config/app_local.php ``` -mod_rewrite needs to be enabled: +mod_rewrite needs to be enabled if __using apache__: ```bash sudo a2enmod rewrite @@ -106,16 +115,31 @@ sudo rm /var/www/cerebrate/tmp/cache/persistent/* Create an apache config file for cerebrate / ssh key and point the document root to /var/www/cerebrate/webroot and you're good to go -For development installs the following can be done: +For development installs the following can be done for either apache or nginx: ```bash +# Apache # This configuration is purely meant for local installations for development / testing # Using HTTP on an unhardened apache is by no means meant to be used in any production environment -sudo cp /var/www/cerebrate/INSTALL/cerebrate_dev.conf /etc/apache2/sites-available/ -sudo ln -s /etc/apache2/sites-available/cerebrate_dev.conf /etc/apache2/sites-enabled/ +sudo cp /var/www/cerebrate/INSTALL/cerebrate_apache_dev.conf /etc/apache2/sites-available/ +sudo ln -s /etc/apache2/sites-available/cerebrate_apache_dev.conf /etc/apache2/sites-enabled/ sudo service apache2 restart ``` +OR + +```bash +# NGINX +# This configuration is purely meant for local installations for development / testing +# Using HTTP on an unhardened apache is by no means meant to be used in any production environment +sudo cp /var/www/cerebrate/INSTALL/cerebrate_nginx.conf /etc/nginx/sites-available/ +sudo ln -s /etc/nginx/sites-available/cerebrate_nginx.conf /etc/nginx/sites-enabled/ +sudo systemctl disable apache2 # may be required if apache is using port +sudo service nginx restart +sudo systemctl enable nginx + +``` + Now you can point your browser to: http://localhost:8000 To log in use the default credentials below: diff --git a/INSTALL/cerebrate_dev.conf b/INSTALL/cerebrate_apache_dev.conf old mode 100755 new mode 100644 similarity index 100% rename from INSTALL/cerebrate_dev.conf rename to INSTALL/cerebrate_apache_dev.conf diff --git a/INSTALL/cerebrate_nginx.conf b/INSTALL/cerebrate_nginx.conf new file mode 100644 index 0000000..e69de29 From e3168dacfad7980c9012f2a20e748231c21ce465 Mon Sep 17 00:00:00 2001 From: drizzit56 <60116496+drizzit56@users.noreply.github.com> Date: Fri, 29 Oct 2021 00:33:11 +0100 Subject: [PATCH 2/2] adding nginx config --- INSTALL/cerebrate_nginx.conf | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/INSTALL/cerebrate_nginx.conf b/INSTALL/cerebrate_nginx.conf index e69de29..59ad861 100644 --- a/INSTALL/cerebrate_nginx.conf +++ b/INSTALL/cerebrate_nginx.conf @@ -0,0 +1,37 @@ +## Cerebrate Nginx Web Server Configuration +server { + listen 8000; + # listen 443 ssl; + + root /var/www/cerebrate/webroot; + error_log /var/log/nginx/cerebrate_error.log; + access_log /var/log/nginx/cerebrate_access.log; + + # Add index.php to the list if you are using PHP + index index.html index.htm index.nginx-debian.html index.php; + + server_name _; + + # Configure Crypto Keys/Certificates/DH + # If enabling this setting change port above, should also set the server name + # ssl_certificate /path/to/ssl/cert; + # ssl_certificate_key /path/to/ssl/cert; + + # enable HSTS + # add_header Strict-Transport-Security "max-age=15768000; includeSubdomains"; + # add_header X-Frame-Options SAMEORIGIN; + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } +}