aboutsummaryrefslogtreecommitdiffstats
path: root/.ddev/nginx_full/nginx-site.conf
blob: 29646a7e3dcc57a2edc2b083c5238c242e3a11a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# ddev nginx config for Hubzilla

server {
  listen 80 default_server;
  listen 443 ssl default_server;

  root /var/www/html/core;

  ssl_certificate /etc/ssl/certs/master.crt;
  ssl_certificate_key /etc/ssl/certs/master.key;

  include /etc/nginx/monitoring.conf;

  index index.php;
  charset utf-8;

  # Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
  sendfile off;
  error_log /dev/stdout info;
  access_log /var/log/nginx/access.log;

  # allow uploads up to 20MB in size
  client_max_body_size 20m;
  client_body_buffer_size 128k;

  include mime.types;

  # rewrite to front controller as default rule
  location / {
    # try_files $uri /index.php?q=$uri;
    if (!-e $request_filename) {
      rewrite ^(.*)$ /index.php?q=$1;
    }
  }

  # make sure webfinger and other well known services aren't blocked
  # by denying dot files and rewrite request to the front controller
  location ^~ /.well-known/ {
    allow all;
    try_files $uri /index.php?q=$uri;
  }

  # statically serve these file types when possible
  # otherwise fall back to front controller
  # allow browser to cache them
  # added .htm for advanced source code editor library
  location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|map|ttf|woff|woff2|svg)$ {
    expires 30d;
    try_files $uri /index.php?q=$uri&$args;
  }

  # block these file types
  location ~* \.(tpl|md|tgz|log|out)$ {
    deny all;
  }

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  # or a unix socket
  # pass the PHP scripts to FastCGI server listening on socket
  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/run/php-fpm.sock;
    fastcgi_buffers 16 16k;
    fastcgi_buffer_size 32k;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param SCRIPT_NAME $fastcgi_script_name;
    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_intercept_errors off;
    # fastcgi_read_timeout should match max_execution_time in php.ini
    fastcgi_read_timeout 10m;
    fastcgi_param SERVER_NAME $host;
    fastcgi_param HTTPS $fcgi_https;
  }

  # deny access to all dot files
  location ~ /\. {
    deny all;
  }

  #deny access to store
  location ~ /store {
    deny  all;
  }

  #deny access to util
  location ~ /util {
    deny  all;
  }

  include /etc/nginx/common.d/*.conf;
  include /mnt/ddev_config/nginx/*.conf;
}