-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.dev-local..example.conf
75 lines (63 loc) · 2.31 KB
/
nginx.dev-local..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 for local development when using docker-compose.
## The key differences are:
## (a) `listen [::]:8080;` and `listen 8080 default_server;`, which refer to the port numbers exposed by the local docker-compose docker network.
## (b) `fastcgi_pass php:9000`, where `php` refers to the service in docker-compose.yml
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 [::]:8080;
listen 8080 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 php:9000; # `php` here is the docker-compose.yml service name. This only works when building with docker-compose.
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
}