Skip to content

Instantly share code, notes, and snippets.

@kawaii
Created December 24, 2020 16:06
Show Gist options
  • Save kawaii/468f24135bc5cf817b922d8491276771 to your computer and use it in GitHub Desktop.
Save kawaii/468f24135bc5cf817b922d8491276771 to your computer and use it in GitHub Desktop.
Example nginx configuration for Movim Docker deployment
upstream movim-http {
server movim:9000;
}
upstream movim-ws {
server movim:8080;
}
fastcgi_cache_path /tmp/nginx_cache levels=1:2 keys_zone=nginx_cache:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
listen 80;
server_name localhost;
index index.php index.html;
root /var/www/html/public;
location / {
try_files $uri /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass movim-http;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location /ws/ {
proxy_pass http://movim-ws;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
}
location /picture {
include fastcgi_params;
add_header X-Cache $upstream_cache_status;
fastcgi_ignore_headers "Cache-Control" "Expires" "Set-Cookie";
fastcgi_cache nginx_cache;
fastcgi_cache_key $request_method$host$request_uri;
fastcgi_cache_valid any 1h;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment