Skip to content

Instantly share code, notes, and snippets.

@x86demon
Last active June 24, 2024 19:58
Show Gist options
  • Save x86demon/96f26aec0311ddebaa925d328fd04420 to your computer and use it in GitHub Desktop.
Save x86demon/96f26aec0311ddebaa925d328fd04420 to your computer and use it in GitHub Desktop.
nginx server config for monolitic repo
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 REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
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;
# httpoxy mitigation (https://httpoxy.org/ https://www.nginx.com/blog/?p=41962)
fastcgi_param HTTP_PROXY "";
fastcgi_buffers 4 512k;
fastcgi_buffer_size 256k;
fastcgi_busy_buffers_size 512k;
fastcgi_read_timeout 60m;
fastcgi_pass unix:/run/php-fpm.socket;
server {
listen 80;
server_name "~^(?<application>[a-zA-Z0-9_-]+)\.(?<folder>\w+)\.loc$";
root /var/www/projects/oro-mono/$folder/application/$application/public;
types_hash_max_size 2048;
client_max_body_size 512m;
client_body_buffer_size 10m;
fastcgi_connect_timeout 900s;
fastcgi_read_timeout 900s;
fastcgi_send_timeout 900s;
send_timeout 900s;
gzip_proxied any;
gzip_types text/plain text/xml text/css application/javascript application/json;
gzip_vary on;
index index.php;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ ^/(index|index_dev|tracking)\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param ORO_TRACKING_DATA_FOLDER /tmp;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
}
@x86demon
Copy link
Author

Only Latin letter, numbers, _ and - are allowed in path

@aivus
Copy link

aivus commented Jul 18, 2018

Seems fastcgi_passmissed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment