Advertisement
Guest User

Untitled

a guest
Nov 17th, 2014
6,677
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. Following software / packages we will be using for this setup, ideal for a personal cloud on Raspberry Pi:
  2.  
  3. • ownCloud 7.0.3
  4. • Nginx
  5. • OpenSSL
  6. • php 5
  7. • Raspbian Wheezy
  8.  
  9. 1. Tuning up the Raspberry Pi
  10. Following changes needs to be made under Raspberry Pi configuration
  11. sudo raspi-config
  12.  
  13. a. Expand the root filesystem to have enough space for the cloud
  14. Select "Expand Filesystem"
  15.  
  16. b. Change locale to en_US.UTF8
  17. Select "Internationalisation Options"
  18.  
  19. c. Memory split, allocate 16M to video graphics
  20. Select "Advanced Options" --> "Memory Split"
  21.  
  22. d. Overclock to Modest or Medium
  23. Select "Overclock"
  24.  
  25. 2. Updating the package lists on Raspberry Pi
  26. sudo apt-get update
  27. sudo apt-get upgrade
  28.  
  29. 3. Creating users Raspbian might already have is user & group
  30. sudo groupadd www-data
  31. sudo usermod -a -G www-data www-data
  32.  
  33. 4. Installing the packages
  34. sudo apt-get install nginx openssl ssl-cert php5-cli php5-sqlite php5-gd php5-common php5-cgi sqlite3 php-pear php-apc curl libapr1 libtool curl libcurl4-openssl-dev php-xml-parser php5 php5-dev php5-gd php5-fpm memcached php5-memcache varnish
  35.  
  36.  
  37. 5. Make sure php5-curl is not installed
  38. sudo apt-get --purge remove php5-curl
  39.  
  40. 6. Creating your SSL certificates for 2 years
  41. sudo openssl req $@ -new -x509 -days 730 -nodes -out /etc/nginx/cert.pem -keyout /etc/nginx/cert.key
  42.  
  43. sudo chmod 600 /etc/nginx/cert.pem
  44. sudo chmod 600 /etc/nginx/cert.key
  45.  
  46. 7. Configuring Ngnix web server replace entire file
  47. sudo nano /etc/nginx/sites-available/default
  48.  
  49.  
  50. upstream php-handler {
  51. server 127.0.0.1:9000;
  52. #server unix:/var/run/php5-fpm.sock;
  53. }
  54.  
  55. server {
  56. listen 80;
  57. server_name yourIPaddress;
  58. return 301 https://$server_name$request_uri; # enforce https
  59. }
  60.  
  61. server {
  62. listen 443 ssl;
  63. server_name yourIPaddress;
  64.  
  65. ssl_certificate /etc/nginx/cert.pem;
  66. ssl_certificate_key /etc/nginx/cert.key;
  67.  
  68. # Path to the root of your installation
  69. root /var/www/owncloud;
  70.  
  71. client_max_body_size 1000M; # set max upload size
  72. fastcgi_buffers 64 4K;
  73.  
  74. rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
  75. rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
  76. rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
  77.  
  78. index index.php;
  79. error_page 403 /core/templates/403.php;
  80. error_page 404 /core/templates/404.php;
  81.  
  82. location = /robots.txt {
  83. allow all;
  84. log_not_found off;
  85. access_log off;
  86. }
  87.  
  88. location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
  89. deny all;
  90. }
  91.  
  92. location / {
  93. # The following 2 rules are only needed with webfinger
  94. rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
  95. rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
  96.  
  97. rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
  98. rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
  99.  
  100. rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
  101.  
  102. try_files $uri $uri/ index.php;
  103. }
  104.  
  105. location ~ \.php(?:$|/) {
  106. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  107. include fastcgi_params;
  108. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  109. fastcgi_param PATH_INFO $fastcgi_path_info;
  110. fastcgi_param HTTPS on;
  111. fastcgi_pass php-handler;
  112. }
  113.  
  114. # Optional: set long EXPIRES header on static assets
  115. location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
  116. expires 30d;
  117. # Optional: Don't log access to assets
  118. access_log off;
  119. }
  120.  
  121. }
  122.  
  123.  
  124. 8. Configuring max upload limit in php
  125. sudo nano /etc/php5/fpm/php.ini
  126.  
  127. Tip: Use ctrl+w to search below lines and update:
  128. upload_max_filesize = 1000M
  129. post_max_size = 1000M
  130.  
  131. 9. Configuring PHP
  132. sudo nano /etc/php5/fpm/pool.d/www.conf
  133. Change the following line from:
  134. listen = /var/run/php5-fpm.sock
  135. to
  136. listen = 127.0.0.1:9000
  137.  
  138. sudo nano /etc/dphys-swapfile
  139. Change the following line from:
  140. CONF_SWAPSIZE=100
  141. to
  142. CONF_SWAPSIZE=512
  143.  
  144. 10. Restart web server and Php
  145. sudo /etc/init.d/php5-fpm restart
  146. sudo /etc/init.d/nginx restart
  147.  
  148. 11. Install ownCloud version 7.0.3 used here
  149. sudo mkdir -p /var/www/owncloud
  150. sudo wget https://download.owncloud.org/community/owncloud-7.0.3.tar.bz2
  151. sudo tar xvf owncloud-7.0.3.tar.bz2
  152. sudo mv owncloud/ /var/www/
  153. sudo chown -R www-data:www-data /var/www
  154. rm -rf owncloud owncloud-7.0.3.tar.bz2
  155.  
  156. 12. Login to the IP address https://
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement