]> jfr.im git - uguu.git/blob - README.md
Merge pull request #49 from avail/avail-patch-1
[uguu.git] / README.md
1 # About
2 [Uguu.se](http://uguu.se) source code, stores files and deletes after X amount of time.
3
4 # Tested with:
5 * Apache (PHP 5.4) on Ubuntu 14.04 LTS
6 * Apache (PHP 5.6) on Debian 8 Jessie
7 * Apache (PHP 5.6.33 (remi-php56)) on CentOS 6.9
8 * Nginx+PHP5-FPM (PHP 5.4) on Debian 7 Wheezy
9 * Nginx+PHP5-FPM (PHP 5.6) on Debian 8 Jessie
10 * Nginx+PHP7-FPM (PHP 7.0) on Debian 9 Stretch
11 * [Caddy](https://caddyserver.com/) + php7.0-fpm on Ubuntu 16.04.4 LTS
12
13 # Install:
14
15 * Deploy base code, for example with `git clone https://github.com/nokonoko/Uguu.git`
16 * Modify includes/config.php (copy config.template.php as a starting point) to set up the main options for Uguu.
17 * Some file extensions are blocked by default, this can be changed via includes/config.php's CONFIG_BLOCKED_EXTENSIONS value.
18 * Copy `rain/template/footer.template.html` as `rain/template/footer.html` and personalize the footer as you wish
19 * Execute check.sh regularly with cron to delete old files: `crontab -e` and add `0,15,30,45 * * * * cd /path/to/uguu/includes && bash check.sh` (or adapt if you know how cron works).
20 * Make the Uguu/public/files and Uguu/rain/cache directory modifiable by the web server user:
21 `chown -R www-data:www-data /path/to/Uguu/public/files` and `chown -R www-data:www-data /path/to/Uguu/rain/cache`
22 * Make sure the Uguu/public/files folder is not indexable, you may use a virtual host config similar to this one using Apache:
23
24 ```
25 <VirtualHost *:80>
26 ServerName path.to.uguu
27
28 DocumentRoot /var/www/Uguu/
29 <Directory /var/www/Uguu/>
30 AllowOverride All
31 Require all granted
32 </Directory>
33
34 Alias "/files" "/var/www/Uguu/public/files/"
35 <Directory /var/www/Uguu/public/files/>
36 <Files *>
37 SetHandler default-handler
38 </Files>
39 AllowOverride None
40 Options -Indexes
41 Require all granted
42 </Directory>
43
44 </VirtualHost>
45 ```
46
47 Or something like this using Nginx+PHP-FPM:
48
49 uguu.se
50 ```
51 server{
52 listen 104.243.35.197:80;
53 server_name uguu.se www.uguu.se;
54
55 root /home/neku/www/uguu/;
56 autoindex off;
57 index index.html index.php;
58
59 location ~* \.php$ {
60 fastcgi_pass unix:/var/run/php5-fpm.sock;
61 fastcgi_intercept_errors on;
62 fastcgi_index index.php;
63 fastcgi_split_path_info ^(.+\.php)(.*)$;
64 include fastcgi_params;
65 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
66 }
67
68 error_page 404 /404.html;
69 error_page 403 /404.html;
70 location /404.html {
71 root /home/neku/www;
72 }
73 }
74 ```
75
76 a.uguu.se (notice that scripts e.g PHP will NOT be executed from this subdomain)
77 ```
78 server{
79 listen 104.243.35.197:80;
80 server_name a.uguu.se www.a.uguu.se;
81
82 root /home/neku/www/files;
83 autoindex off;
84 index index.html;
85
86 error_page 404 /404.html;
87 error_page 403 /404.html;
88 location /404.html {
89 root /home/neku/www;
90 }
91 }
92 ```
93
94 Or something like this for usage with caddy:
95 ```
96 uguu.se {
97 fastcgi / /var/run/php/php7.0-fpm.sock php
98 root /home/neku/www
99 }
100
101 a.uguu.se {
102 root /home/neku/www/files
103 }
104 ```
105
106
107 # Using the API
108
109 * Leaving POST value 'name' empty will cause it to save using the original filename.
110 * Leaving POST value 'randomname' empty will cause it to use original filename or custom name if 'name' is set to file.ext.
111
112 * Putting anything into POST value 'randomname' will cause it to return a random filename + ext (xxxxxx.ext).
113 * Putting a custom name into POST value 'name' will cause it to return a custom filename (yourpick.ext).
114
115 E.g:
116 * curl -i -F name=test.jpg -F file=@localfile.jpg http://path.to.uguu/api.php?d=upload (HTML Response)
117 * curl -i -F name=test.jpg -F file=@localfile.jpg http://path.to.uguu/api.php?d=upload-tool (Plain text Response)