2022-08-28 20:32:06 -05:00
|
|
|
user root;
|
2020-06-02 09:14:23 -05:00
|
|
|
worker_processes auto;
|
|
|
|
pid /run/nginx.pid;
|
|
|
|
include /etc/nginx/modules-enabled/*.conf;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 768;
|
|
|
|
# multi_accept on;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
|
|
|
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;
|
|
|
|
|
|
|
|
access_log /var/log/nginx/access.log;
|
|
|
|
error_log /var/log/nginx/error.log;
|
|
|
|
|
|
|
|
gzip on;
|
|
|
|
|
|
|
|
gzip_vary on;
|
|
|
|
gzip_proxied any;
|
2021-01-25 11:34:04 -05:00
|
|
|
gzip_comp_level 3;
|
2020-06-02 09:14:23 -05:00
|
|
|
gzip_buffers 16 8k;
|
|
|
|
gzip_http_version 1.1;
|
|
|
|
|
|
|
|
gzip_types text/plain text/css text/javascript application/javascript application/json application/transit+json;
|
|
|
|
|
|
|
|
map $http_upgrade $connection_upgrade {
|
|
|
|
default upgrade;
|
2021-01-09 06:22:08 -05:00
|
|
|
'' close;
|
2020-06-02 09:14:23 -05:00
|
|
|
}
|
|
|
|
|
2023-06-22 08:14:16 -05:00
|
|
|
proxy_cache_path /tmp/cache/ levels=2:2 keys_zone=penpot:20m;
|
|
|
|
proxy_cache_methods GET HEAD;
|
|
|
|
proxy_cache_valid any 48h;
|
|
|
|
proxy_cache_key "$host$request_uri";
|
2020-06-02 09:14:23 -05:00
|
|
|
|
|
|
|
server {
|
|
|
|
listen 3449 default_server;
|
|
|
|
server_name _;
|
|
|
|
|
2024-02-19 08:28:39 -05:00
|
|
|
client_max_body_size 300M;
|
2020-06-02 09:14:23 -05:00
|
|
|
charset utf-8;
|
|
|
|
|
|
|
|
proxy_http_version 1.1;
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Scheme $scheme;
|
|
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
2022-02-28 11:16:27 -05:00
|
|
|
resolver 127.0.0.11;
|
2020-12-30 08:38:00 -05:00
|
|
|
|
2020-06-02 09:14:23 -05:00
|
|
|
etag off;
|
|
|
|
|
2021-01-09 06:22:08 -05:00
|
|
|
root /home/penpot/penpot/frontend/resources/public;
|
|
|
|
|
2020-12-30 08:38:00 -05:00
|
|
|
location @handle_redirect {
|
|
|
|
set $redirect_uri "$upstream_http_location";
|
|
|
|
set $redirect_host "$upstream_http_x_host";
|
|
|
|
set $redirect_cache_control "$upstream_http_cache_control";
|
2022-09-26 17:41:01 -05:00
|
|
|
set $real_mtype "$upstream_http_x_mtype";
|
2020-12-30 08:38:00 -05:00
|
|
|
|
|
|
|
proxy_set_header Host "$redirect_host";
|
2021-01-04 12:41:05 -05:00
|
|
|
proxy_hide_header etag;
|
2020-12-30 08:38:00 -05:00
|
|
|
proxy_hide_header x-amz-id-2;
|
|
|
|
proxy_hide_header x-amz-request-id;
|
|
|
|
proxy_hide_header x-amz-meta-server-side-encryption;
|
|
|
|
proxy_hide_header x-amz-server-side-encryption;
|
|
|
|
proxy_pass $redirect_uri;
|
2021-01-04 12:41:05 -05:00
|
|
|
|
2022-09-26 17:41:01 -05:00
|
|
|
add_header x-internal-redirect "$redirect_uri";
|
|
|
|
add_header x-cache-control "$redirect_cache_control";
|
|
|
|
add_header cache-control "$redirect_cache_control";
|
|
|
|
add_header content-type "$real_mtype";
|
2021-01-04 12:41:05 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
location /assets {
|
|
|
|
proxy_pass http://127.0.0.1:6060/assets;
|
|
|
|
recursive_error_pages on;
|
|
|
|
proxy_intercept_errors on;
|
|
|
|
error_page 301 302 307 = @handle_redirect;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /internal/assets {
|
|
|
|
internal;
|
2021-03-31 03:58:57 -05:00
|
|
|
alias /home/penpot/penpot/backend/assets;
|
2021-01-09 06:22:08 -05:00
|
|
|
add_header x-internal-redirect "$upstream_http_x_accel_redirect";
|
2021-01-04 12:41:05 -05:00
|
|
|
}
|
|
|
|
|
2023-08-24 06:19:46 -05:00
|
|
|
# On production, this is controlled by ELB
|
2022-03-22 02:12:31 -05:00
|
|
|
location /api/export {
|
|
|
|
proxy_pass http://127.0.0.1:6061;
|
|
|
|
}
|
|
|
|
|
2021-01-04 12:41:05 -05:00
|
|
|
location /api {
|
|
|
|
proxy_pass http://127.0.0.1:6060/api;
|
2023-12-01 10:18:39 -05:00
|
|
|
proxy_buffering off;
|
|
|
|
proxy_http_version 1.1;
|
2020-12-30 08:38:00 -05:00
|
|
|
}
|
|
|
|
|
2022-12-21 05:53:56 -05:00
|
|
|
location /admin {
|
|
|
|
proxy_pass http://127.0.0.1:6063/admin;
|
|
|
|
}
|
|
|
|
|
2021-02-11 11:57:41 -05:00
|
|
|
location /webhooks {
|
|
|
|
proxy_pass http://127.0.0.1:6060/webhooks;
|
|
|
|
}
|
|
|
|
|
2021-01-24 10:04:23 -05:00
|
|
|
location /dbg {
|
|
|
|
proxy_pass http://127.0.0.1:6060/dbg;
|
|
|
|
}
|
|
|
|
|
2021-03-30 07:52:42 -05:00
|
|
|
location /telemetry {
|
|
|
|
proxy_pass http://127.0.0.1:6070/inbox;
|
|
|
|
}
|
|
|
|
|
2020-06-18 13:08:22 -05:00
|
|
|
location /playground {
|
2020-11-11 06:55:59 -05:00
|
|
|
alias /home/penpot/penpot/experiments/;
|
2020-06-18 13:08:22 -05:00
|
|
|
add_header Cache-Control "no-cache, max-age=0";
|
|
|
|
autoindex on;
|
|
|
|
}
|
|
|
|
|
2020-06-02 09:14:23 -05:00
|
|
|
location /ws/notifications {
|
|
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
|
|
proxy_set_header Connection 'upgrade';
|
|
|
|
proxy_pass http://127.0.0.1:6060/ws/notifications;
|
|
|
|
}
|
|
|
|
|
2021-01-04 12:41:05 -05:00
|
|
|
location / {
|
2023-07-10 05:00:29 -05:00
|
|
|
location ~ ^/github/penpot-files/(?<template_file>[a-zA-Z0-9\-\_\.]+) {
|
|
|
|
proxy_pass https://raw.githubusercontent.com/penpot/penpot-files/main/$template_file;
|
|
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
|
|
proxy_set_header User-Agent "curl/7.74.0";
|
|
|
|
proxy_set_header Host "raw.githubusercontent.com";
|
|
|
|
proxy_set_header Accept "*/*";
|
|
|
|
add_header Access-Control-Allow-Origin $http_origin;
|
|
|
|
proxy_buffering off;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/internal/gfonts/font/(?<font_file>.+) {
|
|
|
|
proxy_pass https://fonts.gstatic.com/s/$font_file;
|
|
|
|
|
|
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
|
|
proxy_hide_header Cross-Origin-Resource-Policy;
|
|
|
|
proxy_hide_header Link;
|
|
|
|
proxy_hide_header Alt-Svc;
|
|
|
|
proxy_hide_header Cache-Control;
|
|
|
|
proxy_hide_header Expires;
|
|
|
|
proxy_hide_header Cross-Origin-Opener-Policy;
|
|
|
|
proxy_hide_header Report-To;
|
|
|
|
|
|
|
|
proxy_ignore_headers Set-Cookie Vary Cache-Control Expires;
|
|
|
|
|
|
|
|
proxy_set_header User-Agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36";
|
|
|
|
proxy_set_header Host "fonts.gstatic.com";
|
|
|
|
proxy_set_header Accept "*/*";
|
|
|
|
|
|
|
|
proxy_cache penpot;
|
|
|
|
|
|
|
|
add_header Access-Control-Allow-Origin $http_origin;
|
|
|
|
add_header Cache-Control max-age=86400;
|
|
|
|
add_header X-Cache-Status $upstream_cache_status;
|
|
|
|
}
|
|
|
|
|
2023-08-24 06:19:46 -05:00
|
|
|
location ~ ^/internal/gfonts/css {
|
|
|
|
proxy_pass https://fonts.googleapis.com/css?$args;
|
|
|
|
proxy_hide_header Access-Control-Allow-Origin;
|
|
|
|
proxy_hide_header Cross-Origin-Resource-Policy;
|
|
|
|
proxy_hide_header Link;
|
|
|
|
proxy_hide_header Alt-Svc;
|
|
|
|
proxy_hide_header Cache-Control;
|
|
|
|
proxy_hide_header Expires;
|
|
|
|
|
|
|
|
proxy_ignore_headers Set-Cookie Vary Cache-Control Expires;
|
|
|
|
|
|
|
|
proxy_set_header User-Agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36";
|
|
|
|
proxy_set_header Host "fonts.googleapis.com";
|
|
|
|
proxy_set_header Accept "*/*";
|
|
|
|
|
|
|
|
proxy_cache penpot;
|
|
|
|
|
|
|
|
add_header Access-Control-Allow-Origin $http_origin;
|
|
|
|
add_header Cache-Control max-age=86400;
|
|
|
|
add_header X-Cache-Status $upstream_cache_status;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~ ^/js/config.js$ {
|
|
|
|
add_header Cache-Control "no-store, no-cache, max-age=0" always;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~* \.(js|css|jpg|svg|png)$ {
|
|
|
|
# We set no cache only on devenv
|
|
|
|
add_header Cache-Control "no-store, no-cache, max-age=0" always;
|
|
|
|
# add_header Cache-Control "max-age=604800" always; # 7 days
|
|
|
|
}
|
|
|
|
|
2023-07-06 02:48:13 -05:00
|
|
|
location ~ ^/(/|css|fonts|images|js|wasm) {
|
|
|
|
}
|
2023-08-24 06:19:46 -05:00
|
|
|
|
2023-07-06 02:48:13 -05:00
|
|
|
location ~ ^/[^/]+/(.*)$ {
|
2023-07-06 12:00:10 -05:00
|
|
|
return 301 " /404";
|
2023-07-06 02:48:13 -05:00
|
|
|
}
|
|
|
|
|
2021-06-17 01:00:08 -05:00
|
|
|
add_header Last-Modified $date_gmt;
|
2023-08-24 06:19:46 -05:00
|
|
|
add_header Cache-Control "no-store, no-cache, max-age=0" always;
|
2021-06-17 01:00:08 -05:00
|
|
|
if_modified_since off;
|
2023-07-06 02:48:13 -05:00
|
|
|
try_files $uri /index.html$is_args$args =404;
|
2020-06-02 09:14:23 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|