Skip to content

Instantly share code, notes, and snippets.

@artmouse
Created October 5, 2016 12:08
Show Gist options
  • Save artmouse/47ffa6925e79c3b2fb4dcb66d639b23b to your computer and use it in GitHub Desktop.
Save artmouse/47ffa6925e79c3b2fb4dcb66d639b23b to your computer and use it in GitHub Desktop.
Activecollab 5 nginx configuration (with php-fastcgi). I'm not an expert here at all. I managed to make it all work. YMMV.
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
# * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/activecollab/public;
index index.php
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
if (!-e $request_filename) {
rewrite ^/assets/(.*)$ /assets/$1 last;
rewrite ^/avatars/(.*)$ /avatars/$1 last;
rewrite ^/wallpapers/(.*)$ /wallpapers/$1 last;
rewrite ^/verify-existence$ /verify.php last;
rewrite ^/proxy.php$ /proxy.php last;
rewrite ^/api/v([0-9]*)/(.*)$ /api.php?path_info=$2&api_version=$1 last;
rewrite ^$ /router.php last;
rewrite ^(.*) /router.php?path_info=$1 last;
}
}
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_intercept_errors on;
if (!-e $request_filename) {
rewrite ^(.*) /router.php?path_info=$1 last;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment