{"id":4686,"date":"2014-09-22T15:44:43","date_gmt":"2014-09-22T20:44:43","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=4686"},"modified":"2022-12-16T03:17:03","modified_gmt":"2022-12-16T09:17:03","slug":"install-humhub-on-an-ubuntu-vps-with-nginx-and-mariadb","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-humhub-on-an-ubuntu-vps-with-nginx-and-mariadb\/","title":{"rendered":"Install HumHub on an Ubuntu VPS with Nginx and MariaDB"},"content":{"rendered":"
In this guide we will show you how install HumHub on an Ubuntu VPS with Nginx and MariaDB. HumHub is a flexible open source social network application written in PHP on top of the Yii framework. HumHub has a bunch of great features such sharing documents and files, responsive design, user spaces, activity stream and many more. This should work on other Linux VPS <\/a>systems as well but was tested and written for Ubuntu 14.04 VPS<\/a>.<\/p>\n <\/p>\n <\/p>\n Create a root directory for your web site and clone the git repository from github<\/p>\n Configure memcached to listen on localhost (127.0.0.1) and disable UDP:<\/p>\n Restart memcached:<\/p>\n Create a new Nginx server block with the following content<\/p>\n Symlink it and restart the server<\/p>\n Set the correct permissions<\/p>\n Add the following lines in the \/var\/www\/yourwebsite.com\/public_html\/protected\/config\/local\/_settings.php file<\/p>\n For more information about how to manage your HumHub installation, please refer to the Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately. In this guide we will show you how install HumHub on an Ubuntu VPS with Nginx and MariaDB. HumHub is … <\/p>\nUpdate the system and install necessary packages.<\/h4>\n
~# apt-get -y update && apt-get -y upgrade\r\n~# apt-get install software-properties-common python-software-properties git curl imagemagick<\/pre>\n
Install PHP and Nginx<\/h4>\n
apt-get install nginx php5-fpm php5-cli php5-gd php5-mysql php5-curl php5-ldap php5-memcached memcached<\/pre>\n
Clone the git repository<\/h4>\n
~# mkdir -p \/var\/www\/yourwebsite.com\/{public_html,logs}\r\n~# git clone https:\/\/github.com\/humhub\/humhub.git \/var\/www\/yourwebsite.com\/public_html<\/pre>\n
Install MariaDB and create a database.<\/h4>\n
~# apt-key adv --recv-keys --keyserver hkp:\/\/keyserver.ubuntu.com:80 0xcbcb082a1bb943db\r\n~# add-apt-repository 'deb http:\/\/ftp.osuosl.org\/pub\/mariadb\/repo\/10.0\/ubuntu trusty main'\r\n~# apt-get -y update\r\n~# echo -e \"Package: *\\nPin: origin ftp.osuosl.org\\nPin-Priority: 1000\" | tee \/etc\/apt\/preferences.d\/mariadb\r\n~# apt-get install mariadb-server\r\n~# mysql -uroot -p\r\nMariaDB [(none)]> create database humhub;\r\nMariaDB [(none)]> GRANT ALL PRIVILEGES ON humhub.* TO 'humhub'@'localhost' IDENTIFIED BY 'humhubPassword';\r\nMariaDB [(none)]> flush privileges;\r\nMariaDB [(none)]> \\q<\/pre>\n
vi \/etc\/memcached.conf<\/pre>\n
-l 127.0.0.1\r\n-U 0<\/pre>\n
\/etc\/init.d\/memcached restart<\/pre>\n
Nginx configuration<\/h4>\n
~# cat <<'EOF' > \/etc\/nginx\/sites-available\/yourwebsite.com\r\nserver {\r\n server_name yourwebsite.com;\r\n listen 80;\r\n root \/var\/www\/yourwebsite.com\/public_html;\r\n access_log \/var\/www\/yourwebsite.com\/logs\/access.log;\r\n error_log \/var\/www\/yourwebsite.com\/logs\/error.log;\r\n index index.php;\r\n \r\n location \/ {\r\n try_files $uri $uri\/ \/index.php?$args;\r\n }\r\n \r\n location ~* \\.(?:ico|css|js|gif|jpe?g|png|ttf|woff)$ {\r\n access_log off;\r\n expires 30d;\r\n add_header Pragma public;\r\n add_header Cache-Control \"public, mustrevalidate, proxy-revalidate\";\r\n }\r\n \r\n location ~ \\.php$ {\r\n fastcgi_index index.php;\r\n fastcgi_split_path_info ^(.+\\.php)(.*)$;\r\n fastcgi_keep_conn on;\r\n include \/etc\/nginx\/fastcgi_params;\r\n fastcgi_pass unix:\/var\/run\/php5-fpm.sock;\r\n fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n }\r\n \r\n location ~ \/\\.ht {\r\n deny all;\r\n }\r\n\r\n location \/protected {\r\n deny all;\r\n } \r\n\r\n location \/uploads\/file {\r\n deny all;\r\n } \r\n \r\n}\r\nEOF<\/pre>\n
~# ln -s \/etc\/nginx\/sites-available\/yourwebsite.com \/etc\/nginx\/sites-enabled\/yourwebsite.com\r\n~# \/etc\/init.d\/nginx restart<\/pre>\n
~# chown -R www-data: \/var\/www\/yourwebsite.com\/public_html\/<\/pre>\n
Create cron Jobs<\/h4>\n
30 * * * * \/var\/www\/yourwebsite.com\/public_html\/yiic cron hourly >\/dev\/null 2>&1\r\n00 18 * * * \/var\/www\/yourwebsite.com\/public_html\/yiic cron daily >\/dev\/null 2>&1<\/pre>\n
Enable url rewriting<\/h4>\n
\n<?php return array ( 'components'=>
\narray (
\n'urlManager' => array(
\n'urlFormat' => 'path',
\n'showScriptName' => false,
\n),
\n)
\n);
\n<\/code>
\nFinally, open your browser and run the HumHub installation process.<\/p>\nhttp:\/\/yourwebsite.com\/<\/pre>\n
\nHumHub<\/a> website.<\/p>\n
\nPS<\/span><\/strong>. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"