I've gotten Resourcespace running under Ubuntu 12.04 using nginx, and I figured I'd share the configuration just to make it easier for others. Nginx usually works better than Apache especially under heavy load. I'm not claiming this to be an optimized configuration, but it's enough to get you started. If you have criticisms, feel free to throw stones or corrections.
My nginx.conf
---
user www-data;
# set to the # of CPU cores available
worker_processes 8;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
client_max_body_size 500M;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 64 32k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
---
My Virtualhost
---
server {
listen 80;
# since port 80 is set by default, you do not actually need
# to set this, unless of course you are binding to a specific
# address such as listen server-ip-address:80 or alternate port;
index index.php index.html index.htm;
# You will want to set your root here, since otherwise
# $document_root within the php block will not work
# if you set it in the location block you would also have
# to set the php block within that location as well
location / {
# This would replace the typical mod_rewrite rules for wordpress
# it can also be try_files $uri $uri/ @rewrites; where it goes to a
# location @rewrites { ... } where you can place rewrite rules if a file
# or folder is not found.
try_files $uri $uri/ /index.php;
}
location = /favicon.ico { access_log off; log_not_found off; }
# If you haven't created a favicon for your site, you can keep
# your access and error logs clean by turning off the logs
# when a browser requests the fav icon (its also a good way
# to keep your logs from filling with useless information)
location ~ /\. { access_log off; log_not_found off; deny all; }
# You want to make sure that Nginx does not serve any .hidden files
include conf.d/application-specific/resourcespace.conf;
# I prefer to keep my php settings in one file, so I can simply
# paste this single line for each of my virtual hosts
error_log /var/log/nginx/resourcespace.myserver.org.error.log;
access_log /var/log/nginx/resourcespace.myserver.org.access.log;
}
---
--- My /etc/nginx/conf.d/application-specific/resourcespace.conf
fastcgi_intercept_errors on;
# this will allow Nginx to intercept 4xx/5xx error codes
# Nginx will only intercept if there are error page rules defined
# -- This is better placed in the http {} block as a default
# -- so that in the case of wordpress, you can turn it off specifically
# -- in that virtual host's server block
location ~ \.php$ {
# Zero-day exploit defense.
# Won't work properly (404 error) if the file is not stored on this server, which is entirely possible with php-fpm/php-fcgi.
# Comment the 'try_files' line out if you set up php-fpm/php-fcgi on another machine. And then cross your fingers that you won't get hacked.
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
# fastcgi_intercept_errors on;
}
---