Commit 1b87c325787b86d366b3b7eb83786c987bbfb004
1 parent
2716cff344
Exists in
master
Increase file upload limit to 10G
Showing 4 changed files with 14 additions and 4 deletions Inline Diff
conf/.ldap_config.sql.swp
No preview for this file type
conf/nginx.conf
1 | location PATHTOCHANGE { | 1 | location PATHTOCHANGE { |
2 | alias ALIASTOCHANGE; | 2 | alias ALIASTOCHANGE; |
3 | if ($scheme = http) { | 3 | if ($scheme = http) { |
4 | rewrite ^ https://$server_name$request_uri? permanent; | 4 | rewrite ^ https://$server_name$request_uri? permanent; |
5 | } | 5 | } |
6 | client_max_body_size 10G; | ||
6 | index index.php; | 7 | index index.php; |
7 | try_files $uri $uri/ /index.php?$args; | 8 | try_files $uri $uri/ /index.php; |
8 | location ~ [^/]\.php(/|$) { | 9 | location ~ [^/]\.php(/|$) { |
9 | fastcgi_split_path_info ^(.+?\.php)(/.*)$; | 10 | fastcgi_split_path_info ^(.+?\.php)(/.*)$; |
10 | fastcgi_pass unix:/var/run/php5-fpm-NAMETOCHANGE.sock; | 11 | fastcgi_pass unix:/var/run/php5-fpm-NAMETOCHANGE.sock; |
11 | fastcgi_index index.php; | ||
12 | include fastcgi_params; | 12 | include fastcgi_params; |
13 | fastcgi_param REMOTE_USER $remote_user; | 13 | fastcgi_param REMOTE_USER $remote_user; |
14 | fastcgi_param PATH_INFO $fastcgi_path_info; | 14 | fastcgi_param PATH_INFO $fastcgi_path_info; |
15 | fastcgi_param HTTPS on; | ||
15 | } | 16 | } |
16 | } | 17 | } |
18 | |||
19 | location ~ ^PATHTOCHANGE/(data|config|\.ht|db_structure\.xml|README) { | ||
20 | deny all; | ||
21 | } | ||
22 |
conf/php-fpm.ini
File was created | 1 | # Allow large file upload | |
2 | upload_max_filesize=10G | ||
3 | post_max_size=10G | ||
4 |
scripts/install
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | # Retrieve arguments | 3 | # Retrieve arguments |
4 | domain=$1 | 4 | domain=$1 |
5 | path=$2 | 5 | path=$2 |
6 | admin_passwd=$3 | 6 | admin_passwd=$3 |
7 | 7 | ||
8 | if [ "$admin_passwd" = "" ]; then | 8 | if [ "$admin_passwd" = "" ]; then |
9 | echo "Wrong password" | 9 | echo "Wrong password" |
10 | exit 1 | 10 | exit 1 |
11 | fi | 11 | fi |
12 | 12 | ||
13 | # Check domain/path availability | 13 | # Check domain/path availability |
14 | sudo yunohost app checkurl $domain$path -a owncloud | 14 | sudo yunohost app checkurl $domain$path -a owncloud |
15 | if [[ ! $? -eq 0 ]]; then | 15 | if [[ ! $? -eq 0 ]]; then |
16 | exit 1 | 16 | exit 1 |
17 | fi | 17 | fi |
18 | 18 | ||
19 | # Generate random password | 19 | # Generate random password |
20 | db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') | 20 | db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p') |
21 | 21 | ||
22 | # Use 'owncloud' as database name and user | 22 | # Use 'owncloud' as database name and user |
23 | db_user=owncloud | 23 | db_user=owncloud |
24 | 24 | ||
25 | # Initialize database and store mysql password for upgrade | 25 | # Initialize database and store mysql password for upgrade |
26 | sudo yunohost app initdb $db_user -p $db_pwd | 26 | sudo yunohost app initdb $db_user -p $db_pwd |
27 | sudo yunohost app setting owncloud mysqlpwd -v $db_pwd | 27 | sudo yunohost app setting owncloud mysqlpwd -v $db_pwd |
28 | 28 | ||
29 | # Create owncloud user | 29 | # Create owncloud user |
30 | sudo useradd -d /var/www/owncloud owncloud | 30 | sudo useradd -d /var/www/owncloud owncloud |
31 | 31 | ||
32 | # Copy files to the right place | 32 | # Copy files to the right place |
33 | final_path=/var/www/owncloud | 33 | final_path=/var/www/owncloud |
34 | sudo mkdir -p $final_path | 34 | sudo mkdir -p $final_path |
35 | sudo cp -a ../sources/* $final_path | 35 | sudo cp -a ../sources/* $final_path |
36 | sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/owncloud.conf | 36 | sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/owncloud.conf |
37 | sudo cp ../conf/php-fpm.conf /etc/php5/fpm/pool.d/owncloud.conf | 37 | sudo cp ../conf/php-fpm.conf /etc/php5/fpm/pool.d/owncloud.conf |
38 | sudo cp ../conf/php-fpm.ini /etc/php5/fpm/conf.d/20-owncloud.ini | ||
38 | 39 | ||
39 | # Change variables in Owncloud configuration | 40 | # Change variables in Owncloud configuration |
40 | sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/owncloud.conf | 41 | sudo sed -i "s@PATHTOCHANGE@$path@g" /etc/nginx/conf.d/$domain.d/owncloud.conf |
41 | sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/owncloud.conf | 42 | sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" /etc/nginx/conf.d/$domain.d/owncloud.conf |
42 | sudo sed -i "s@NAMETOCHANGE@owncloud@g" /etc/nginx/conf.d/$domain.d/owncloud.conf | 43 | sudo sed -i "s@NAMETOCHANGE@owncloud@g" /etc/nginx/conf.d/$domain.d/owncloud.conf |
43 | sudo sed -i "s@NAMETOCHANGE@owncloud@g" /etc/php5/fpm/pool.d/owncloud.conf | 44 | sudo sed -i "s@NAMETOCHANGE@owncloud@g" /etc/php5/fpm/pool.d/owncloud.conf |
44 | 45 | ||
45 | # Set permissions to owncloud directory and /home directories | 46 | # Set permissions to owncloud directory and /home directories |
46 | sudo chown -hR owncloud: $final_path | 47 | sudo chown -hR owncloud: $final_path |
47 | for i in $(ls /home) | 48 | for i in $(ls /home) |
48 | do | 49 | do |
49 | if [[ ! $i == yunohost.* ]]; | 50 | if [[ ! $i == yunohost.* ]]; |
50 | then | 51 | then |
51 | sudo setfacl -m g:owncloud:rwx /home/$i | 52 | sudo setfacl -m g:owncloud:rwx /home/$i |
52 | fi | 53 | fi |
53 | done | 54 | done |
54 | 55 | ||
55 | # Reload Nginx and regenerate SSOwat conf | 56 | # Reload Nginx and regenerate SSOwat conf |
56 | sudo service php5-fpm restart | 57 | sudo service php5-fpm restart |
57 | sudo service nginx reload | 58 | sudo service nginx reload |
58 | sudo yunohost app setting owncloud skipped_uris -v "/" | 59 | sudo yunohost app setting owncloud skipped_uris -v "/" |
59 | sudo yunohost app ssowatconf | 60 | sudo yunohost app ssowatconf |
60 | 61 | ||
61 | # Owncloud installation via curl | 62 | # Owncloud installation via curl |
62 | echo "127.0.0.1 $domain #yunoowncloud" | sudo tee -a /etc/hosts | 63 | echo "127.0.0.1 $domain #yunoowncloud" | sudo tee -a /etc/hosts |
63 | curl -kL -X POST https://$domain$path/index.php --data "install=true&adminlogin=admin&adminpass=$admin_passwd&directory=/var/www/owncloud/data&dbtype=mysql&dbuser=$db_user&dbpass=$db_pwd&dbname=$db_user&dbhost=localhost" > /dev/null 2>&1 | 64 | curl -kL -X POST https://$domain$path/index.php --data "install=true&adminlogin=admin&adminpass=$admin_passwd&directory=/var/www/owncloud/data&dbtype=mysql&dbuser=$db_user&dbpass=$db_pwd&dbname=$db_user&dbhost=localhost" > /dev/null 2>&1 |
64 | 65 | ||
65 | # Check if the Mysql database is initialized & running | 66 | # Check if the Mysql database is initialized & running |
66 | sleep 5 | 67 | sleep 5 |
67 | mysql -u $db_user -p$db_pwd $db_user -e "select * from oc_appconfig;" > /dev/null 2>&1 | 68 | mysql -u $db_user -p$db_pwd $db_user -e "select * from oc_appconfig;" > /dev/null 2>&1 |
68 | curl -kL -X POST https://$domain$path/index.php/settings/ajax/enableapp.php --data "appid=user_ldap" -u "admin:$admin_passwd" | 69 | curl -kL -X POST https://$domain$path/index.php/settings/ajax/enableapp.php --data "appid=user_ldap" -u "admin:$admin_passwd" |
69 | result=$? | 70 | result=$? |
70 | loop_number=1 | 71 | loop_number=1 |
71 | while [ $result != 0 ] && [ $loop_number -lt 5 ]; | 72 | while [ $result != 0 ] && [ $loop_number -lt 5 ]; |
72 | do | 73 | do |
73 | sleep 5 | 74 | sleep 5 |
74 | mysql -u $db_user -p$db_pwd $db_user -e "select * from oc_appconfig;" > /dev/null 2>&1 | 75 | mysql -u $db_user -p$db_pwd $db_user -e "select * from oc_appconfig;" > /dev/null 2>&1 |
75 | let result=$? | 76 | let result=$? |
76 | let loop_number++ | 77 | let loop_number++ |
77 | done | 78 | done |
78 | 79 | ||
79 | sudo yunohost app setting owncloud skipped_uris -v "/public.php" | 80 | sudo yunohost app setting owncloud skipped_uris -v "/public.php" |
80 | sudo yunohost app ssowatconf | 81 | sudo yunohost app ssowatconf |
81 | mysql -u $db_user -p$db_pwd $db_user < ../conf/ldap_config.sql | 82 | mysql -u $db_user -p$db_pwd $db_user < ../conf/ldap_config.sql |
82 | 83 | ||
83 | # Remove temporary entry in /etc/hosts | 84 | # Remove temporary entry in /etc/hosts |
84 | sudo sed -i '/yunoowncloud/d' /etc/hosts | 85 | sudo sed -i '/yunoowncloud/d' /etc/hosts |
85 | 86 |