How to setup FengOffice collaboration platform over Nginx

Mark Alan varia at
Sat Jun 11 20:20:03 MSD 2011

How to setup FengOffice collaboration platform over Nginx.

Any suggestions on how to improve the bellow described procedure are
greatly appreciated.

Than you,


Feng Office < >, previously known as OpenGoo,
is an open source collaboration platform (much like a Google Apps
platform that you may install and maintain in your own web or
local server).

I will show how we have set Feng Office in an Ubuntu 10.10 server +
Nginx. I will assume that you already have a properly setup Nginx 1.0.x
with all the ancillary paraphernalia of your choice (including php-fpm,
ssl certificates, a dns or /etc/hosts pointing to feng.localhost, etc.)

# put code in place
sudo mv fengoffice/ /home/fengoffice_1.7.5rc3/
(cd /home/;sudo ln -svfn fengoffice_1.7.5rc3 fengoffice)

# create the feng_db database in MySQL
echo "create database feng_db" | mysql -u root -p
echo "create user 'feng_user'@'localhost' identified by
'feng_user_password'" | mysql -u root -p
echo "grant all on feng_db.* to 'feng_user'@'localhost'" | mysql -u
root -p
echo "flush privileges;use feng_db;show grants for
'feng_user'@'localhost';flush privileges;" | mysql -u root -p

# change permissions to make it more secure
sudo chown -R $USER.www-data /home/fengoffice/
find /home/fengoffice/ -type d -exec chmod 0750 {} \;
(for i in cache config tmp upload; do sudo chmod
0770 /home/fengoffice/$i; done)
find /home/fengoffice/ -type f -exec chmod 0640 {} \;
find /home/fengoffice/ -type f -iname "*.txt" -exec chmod 0600 {} \;
chmod g+r /home/fengoffice/robots.txt
sudo ln -svfn /home/fengoffice /var/www/fengoffice
ls -ld /home/feng* /var/www/feng*

# create a nginx conf file like this
# nginx - /etc/nginx/sites-available/feng
server {
	listen 80;
	server_name feng.localhost;
	# redirect to secure https page
	rewrite ^ https://feng.localhost$request_uri? permanent;
server {
	#listen 80;
	listen 443 ssl;
	server_name feng.localhost;
	access_log /var/log/nginx/feng.access.log;
	error_log /var/log/nginx/feng.error.log;
	root /var/www/fengoffice;
	index index.php;

	ssl_certificate /etc/ssl/certs/excom-web.crt;
	ssl_certificate_key /etc/ssl/private/excom-web.key;
	# gzipping SSL encrypted data is a waste of time
	#gzip  off;

	location ~ ^(?<script>.+\.php) {
		include /etc/nginx/fastcgi_params;
		fastcgi_pass unix:/tmp/php-fpm.socket;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME
	$document_root$fastcgi_script_name; fastcgi_param HTTPS on;

sudo ln -svf /etc/nginx/sites-available/feng /etc/nginx/sites-enabled/
sudo nginx -s reload
sudo /usr/sbin/nginx -t && /etc/init.d/nginx status

# enable writing in the config.php file & set php memory to at least 10M
chmod g+w /home/fengoffice/config/config.php
sudo sed -i '/^memory_limit/s/[0-9]\+M/64M/' /etc/php5/fpm/php.ini

# run feng's own setup from:

# When done with feng's setup, enable https & protect config.php
sed -i '/ROOT_URL/s/http:/https:/' /home/fengoffice/config/config.php
chmod g-w /home/fengoffice/config/config.php

## procedure ends

# You may also enable the following open-source libraries and
applications to work with Feng Office:
ActiveCollab 0.7.1:
Reece Calendar:
Swift Mailer:
Open Flash Chart:

More information about the nginx mailing list