nginx_captive-piratebox.conf 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # PirateBox app for YunoHost
  2. # Copyright (C) 2015 Julien Vaubourg <julien@vaubourg.com>
  3. # Contribute at https://github.com/labriqueinternet/piratebox_ynh
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU Affero General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Affero General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. server {
  18. listen 4280 default_server;
  19. listen [::]:4280 default_server;
  20. root <TPL:NGINX_REALPATH>;
  21. client_max_body_size 10G;
  22. if ($host != '<TPL:DOMAIN>') {
  23. set $args '';
  24. rewrite ^ http://<TPL:DOMAIN>;
  25. }
  26. location /public/uploads/ {
  27. add_header Content-Type "application/octet-stream";
  28. add_header Content-Disposition "attachment; filename=$1";
  29. }
  30. location /public/chat/ {
  31. deny all;
  32. return 403;
  33. }
  34. location ~ \.php {
  35. include fastcgi_params;
  36. client_body_temp_path /var/spool/piratebox/;
  37. fastcgi_pass_request_body off;
  38. client_body_in_file_only clean;
  39. fastcgi_param REQUEST_BODY_FILE $request_body_file;
  40. fastcgi_read_timeout 600;
  41. fastcgi_send_timeout 600;
  42. fastcgi_index index.php;
  43. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  44. fastcgi_pass unix:/var/run/php5-fpm-<TPL:PHP_NAME>.sock;
  45. }
  46. location @piratebox {
  47. rewrite ^/(.*)$ /?/get&dir=$1;
  48. }
  49. location / {
  50. index index.html index.php;
  51. try_files $uri $uri/ @piratebox;
  52. }
  53. access_log /var/log/nginx/piratebox-access.log;
  54. error_log /var/log/nginx/piratebox-error.log;
  55. }