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