Fork of FusionPBX but with LDAP kinda working
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.3 KiB

  1. #!/bin/sh
  2. #move to script directory so all relative paths work
  3. cd "$(dirname "$0")"
  4. #includes
  5. . ./config.sh
  6. . ./colors.sh
  7. . ./environment.sh
  8. #send a message
  9. verbose "Installing the web server"
  10. #change the version of php for arm
  11. if [ ."$cpu_architecture" = ."arm" ]; then
  12. #Pi2 and Pi3 Raspbian
  13. #Odroid
  14. if [ ."$os_codename" = ."stretch" ]; then
  15. php_version=7.2
  16. else
  17. php_version=5.6
  18. fi
  19. fi
  20. #set the version of php
  21. if [ ."$os_codename" = ."bullseye" ]; then
  22. php_version=7.4
  23. fi
  24. if [ ."$os_codename" = ."buster" ]; then
  25. php_version=7.3
  26. fi
  27. if [ ."$os_codename" = ."stretch" ]; then
  28. php_version=7.1
  29. fi
  30. if [ ."$os_codename" = ."jessie" ]; then
  31. php_version=7.1
  32. fi
  33. #enable fusionpbx nginx config
  34. cp nginx/fusionpbx /etc/nginx/sites-available/fusionpbx
  35. #prepare socket name
  36. if [ ."$php_version" = ."5.6" ]; then
  37. sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php5-fpm.sock;#g'
  38. fi
  39. if [ ."$php_version" = ."7.0" ]; then
  40. sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.0-fpm.sock;#g'
  41. fi
  42. if [ ."$php_version" = ."7.1" ]; then
  43. sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.1-fpm.sock;#g'
  44. fi
  45. if [ ."$php_version" = ."7.2" ]; then
  46. sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.2-fpm.sock;#g'
  47. fi
  48. if [ ."$php_version" = ."7.3" ]; then
  49. sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.3-fpm.sock;#g'
  50. fi
  51. if [ ."$php_version" = ."7.4" ]; then
  52. sed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.4-fpm.sock;#g'
  53. fi
  54. ln -s /etc/nginx/sites-available/fusionpbx /etc/nginx/sites-enabled/fusionpbx
  55. #self signed certificate
  56. ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/nginx.key
  57. ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/nginx.crt
  58. #remove the default site
  59. rm /etc/nginx/sites-enabled/default
  60. #update config if LetsEncrypt folder is unwanted
  61. # if [ .$letsencrypt_folder = .false ]; then
  62. # sed -i '151,155d' /etc/nginx/sites-available/fusionpbx
  63. # fi
  64. #add the letsencrypt directory
  65. if [ .$letsencrypt_folder = .true ]; then
  66. mkdir -p /var/www/letsencrypt/
  67. fi
  68. #flush systemd cache
  69. systemctl daemon-reload
  70. #restart nginx
  71. service nginx restart