]>
Commit | Line | Data |
---|---|---|
35bc7430 | 1 | # About |
68c573a6 | 2 | [Uguu.se](http://uguu.se) source code, stores files and deletes after X amount of time. |
8805b1c1 | 3 | |
697953e8 | 4 | # Tested with: |
66809aeb | 5 | * Apache (PHP 5.4) on Ubuntu 14.04 LTS |
2239bd05 | 6 | * Apache (PHP 5.6) on Debian 8 Jessie |
d18a3210 | 7 | * Apache (PHP 5.6.33 (remi-php56)) on CentOS 6.9 |
4e47f01b GJ |
8 | * Nginx+PHP5-FPM (PHP 5.4) on Debian 7 Wheezy |
9 | * Nginx+PHP5-FPM (PHP 5.6) on Debian 8 Jessie | |
077e37e5 | 10 | * Nginx+PHP7-FPM (PHP 7.0) on Debian 9 Stretch |
a405e92a | 11 | * [Caddy](https://caddyserver.com/) + php7.0-fpm on Ubuntu 16.04.4 LTS |
8805b1c1 | 12 | |
697953e8 | 13 | # Install: |
67a54d5c | 14 | |
b6373dfc | 15 | * Deploy base code, for example with `git clone https://github.com/nokonoko/Uguu.git` |
697953e8 PAB |
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. | |
0296af03 | 18 | * Copy `rain/template/footer.template.html` as `rain/template/footer.html` and personalize the footer as you wish |
495eda7b | 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). |
697953e8 PAB |
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` | |
9fea93f6 | 22 | * Make sure the Uguu/public/files folder is not indexable, you may use a virtual host config similar to this one using Apache: |
697953e8 PAB |
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/> | |
af1f50cf | 36 | <Files *> |
0f98d00c PAB |
37 | SetHandler default-handler |
38 | </Files> | |
39 | AllowOverride None | |
40 | Options -Indexes | |
41 | Require all granted | |
697953e8 PAB |
42 | </Directory> |
43 | ||
44 | </VirtualHost> | |
45 | ``` | |
67a54d5c | 46 | |
9fea93f6 | 47 | Or something like this using Nginx+PHP-FPM: |
e3fe8ee9 GJ |
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 | ||
e3fe8ee9 GJ |
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 | ||
e3fe8ee9 GJ |
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 | ||
a405e92a | 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 | ||
e3fe8ee9 | 106 | |
67a54d5c GJ |
107 | # Using the API |
108 | ||
c2bbdeb0 GJ |
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. | |
2239bd05 | 111 | |
c2bbdeb0 GJ |
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). | |
2239bd05 | 114 | |
e7c58287 | 115 | E.g: |
d0cf9b3d PAB |
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) |