/
php-symfony.conf.twig
43 lines (34 loc) · 1.48 KB
/
php-symfony.conf.twig
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
{% set host = forService.host|default('localhost') %}
server {
server_name {{ host }};
root /apps/{{ host }}/web;
index index.php index.html index.htm;
access_log /var/log/nginx/{{ host }}-access.log;
error_log /var/log/nginx/{{ host }}-error.log;
location / {
try_files $uri /app.php$is_args$args;
}
location ~ ^/(index|app|app_dev|config)\.php(/|$) {
fastcgi_pass {{ forService.identifier }}:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param HTTPS off;
fastcgi_param REMOTE_ADDR 127.0.0.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, PATCH, PUT, DELETE, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With,X-IODevice-Token';
add_header 'Access-Control-Allow-Origin' "$http_origin";
return 204;
}
}
location ~ \.php$ {
return 404;
}
}