{"id":18441,"date":"2016-01-12T14:41:06","date_gmt":"2016-01-12T20:41:06","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=18441"},"modified":"2022-12-09T05:56:13","modified_gmt":"2022-12-09T11:56:13","slug":"how-to-install-elgg-with-nginx-on-ubuntu-14-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-elgg-with-nginx-on-ubuntu-14-04\/","title":{"rendered":"How to install Elgg with Nginx on Ubuntu 14.04"},"content":{"rendered":"
This step by step tutorial will show you how to install Elgg with Nginx on an Ubuntu 14.04 VPS<\/strong>. Elgg is an open source social networking engine that is easy to install and set up, then used to power your social network. Make sure your OS package list and the OS packages are up to date by running the following commands:<\/p>\n Stop and remove Apache2 service:<\/p>\n Install Nginx and MySQL on your virtual server:<\/p>\n Configure nginx to start on boot:<\/p>\n Install PHP and PHP modules required by Elgg:<\/p>\n Download the latest version of Elgg at https:\/\/elgg.org\/download.php and upload it to the ‘opt’ directory on your server:<\/p>\n It is recommended to use an SSL certificate<\/a> for your Elgg installation. Save the SSL certificate and its private key to files named ‘file.crt’ and ‘private.key’ respectively and upload them to ‘\/etc\/nginx’ directory. Add the following lines:<\/p>\n Do not forget to replace your-domain.com with your actual domain name.<\/p>\n Enable the new Nginx configuration file:<\/p>\n Open the ‘\/etc\/php5\/fpm\/pool.d\/www.conf’ configuration file and change the ‘listen’ variable from:<\/p>\n to<\/p>\n Test the Nginx configuration:<\/p>\n Restart php5-fpm and Nginx services for the changes to take effect:<\/p>\n Set the proper permissions of the ‘\/var\/www\/elgg’ directory:<\/p>\n Elgg needs a special directory outside of the document root to store uploaded files including profile icons and photos, so create a directory and set proper permissions using the following commands:<\/p>\n Also, Elgg requires a MySQL database, so create a new MySQL user and database:<\/p>\n Do not forget to replace ‘Y0UR-PASSW0RD’ with a strong password. That is it. The Elgg installation is complete. PS<\/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":" This step by step tutorial will show you how to install Elgg with Nginx on an Ubuntu 14.04 VPS. Elgg … <\/p>\n
\nThis tutorial was tested and written for an Ubuntu VPS<\/a>, but it should work on any Debian based Linux distribution.
\n
\nAt the time of writing of this tutorial, Elgg 2.0.1 is the latest and recommended version and it requires:<\/p>\n\n
sudo apt-get update\r\nsudo apt-get upgrade<\/pre>\n
sudo service apache2 stop\r\nsudo apt-get remove apache2\r\nsudo apt-get autoremove<\/pre>\n
sudo apt-get update\r\nsudo apt-get install nginx mysql-server<\/pre>\n
sudo update-rc.d -f nginx defaults<\/pre>\n
sudo apt-get install php5 php5-cli php5-fpm php5-mysql php5-gd<\/pre>\n
cd \/opt\/\r\nwget https:\/\/elgg.org\/getelgg.php?forward=elgg-2.0.1.zip -O elgg-2.0.1.zip\r\nunzip elgg-2.0.1.zip\r\nmv elgg-2.0.1 \/var\/www\/elgg\/<\/pre>\n
\nRemove the default Nginx server block, then create a new Nginx configuration file and add the following virtual block for your domain name:<\/p>\nrm \/etc\/nginx\/sites-enabled\/default\r\nvi \/etc\/nginx\/sites-available\/your-domain.com.conf<\/pre>\n
server {\r\nlisten 80;\r\n# If you have an SSL certificate, uncomment the 3 lines below:\r\n# listen 443 ssl;\r\n# ssl_certificate \/etc\/nginx\/file.crt;\r\n# ssl_certificate_key \/etc\/nginx\/private.key;\r\n\r\n\tserver_name your-domain.com;\r\n\troot \/var\/www\/elgg\/;\r\n\tindex index.php index.html index.htm;\r\n\t\r\n\tgzip on;\r\n\tgzip_types\r\n\t\ttext\/css\r\n\t\ttext\/javascript\r\n\t\ttext\/xml\r\n\t\ttext\/plain\r\n\t\ttext\/x-component\r\n\t\tapplication\/javascript\r\n\t\tapplication\/x-javascript\r\n\t\tapplication\/json\r\n\t\tapplication\/xml\r\n\t\tapplication\/rss+xml\r\n\t\tfont\/truetype\r\n\t\tfont\/opentype\r\n\t\tapplication\/vnd.ms-fontobject\r\n\t\timage\/svg+xml;\r\n\r\n\taccess_log \/var\/log\/nginx\/your-domain.com-access.log;\r\n\terror_log \/var\/log\/nginx\/your-domain.com-error.log;\r\n\r\n\tclient_max_body_size 8M;\r\n\r\n\tlocation ~ (^\\.|\/\\.) {\r\n\t\treturn 403;\r\n\t}\r\n\r\n\tlocation = \/rewrite.php {\r\n\t\trewrite ^(.*)$ \/install.php;\r\n\t}\r\n\r\n\tlocation \/ {\r\n\t\ttry_files $uri $uri\/ @elgg;\r\n\t}\r\n\r\n\tlocation ~ \\.php$ {\r\n\t\ttry_files $uri @elgg;\r\n\t\tfastcgi_index index.php;\r\n\t\tfastcgi_pass localhost:9000;\r\n\t\tfastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n\t\tinclude \/etc\/nginx\/fastcgi_params;\r\n\t}\r\n\r\n\tlocation @elgg {\r\n\t\tfastcgi_pass localhost:9000;\r\n\r\n\t\tinclude \/etc\/nginx\/fastcgi_params;\r\n\t\tfastcgi_param SCRIPT_FILENAME $document_root\/index.php;\r\n\t\tfastcgi_param SCRIPT_NAME \/index.php;\r\n\t\tfastcgi_param QUERY_STRING __elgg_uri=$uri&$args;\r\n\t}\r\n}\r\n<\/pre>\n
ln -sf \/etc\/nginx\/sites-available\/your-domain.com.conf \/etc\/nginx\/sites-enabled\/<\/pre>\n
listen = \/var\/run\/php5-fpm.sock<\/pre>\n
listen = 127.0.0.1:9000;<\/pre>\n
# nginx -t\r\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\r\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/pre>\n
sudo service php5-fpm restart\r\nsudo service nginx restart<\/pre>\n
sudo chown www-data:www-data -R \/var\/www\/elgg\/<\/pre>\n
mkdir -p \/opt\/data\r\nchmod 770 \/opt\/data\r\nchown www-data \/opt\/data<\/pre>\n
mysql -u root -p\r\nmysql> create database elggdb;\r\nmysql> GRANT ALL PRIVILEGES ON elggdb.* TO 'elgguser'@'localhost' IDENTIFIED BY 'Y0UR-PASSW0RD';\r\nmysql> flush privileges;\r\nmysql> quit<\/pre>\n
\nOpen http:\/\/your-domain.com\/install.php in your favorite web browser and follow the on-screen instructions: enter the database username, password and database name, site name, site email address, data directory and create an administrator account.
\n<\/p>\n
\nOf 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 install Elgg with Nginx<\/strong> for you. They are available 24×7 and will take care of your request immediately.<\/p>\n