-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.aws..example.conf
75 lines (63 loc) · 2.39 KB
/
nginx.aws..example.conf
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
## This NGINX conf is used by *all* AWS ECS Fargate runtime environments
## The key differences are:
## (a) `listen [::]:80;` and `listen 80 default_server;`, which refer to the port numbers exposed by AWS ECS Fargate to the Load Balancer Target Groups
## (b) `fastcgi_pass localhost:9000`, where `localhost` is required as AWS ECS Fargate uses the 'sidecar' pattern for both NGINX and PHP-FPM containers.
pid /var/run/nginx.pid;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
include fastcgi.conf;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
server_tokens off;
client_max_body_size 10M;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
server {
listen [::]:80;
listen 80 default_server;
server_name _;
root /app/public;
index index.php index.html index.htm;
access_log /dev/stdout;
error_log /dev/stdout info;
disable_symlinks off;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
add_header Access-Allow-Control-Origin "*";
add_header Access-Allow-Control-Headers "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With, Locale";
add_header Access-Allow-Control-Methods "GET, POST, PUT, DELETE, PATCH, OPTIONS";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass localhost:9000; # using 'localhost' here as this will follow the sidecar pattern, so both containers will be allocated the same node
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
}