]>
Commit | Line | Data |
---|---|---|
540ef5e0 FM |
1 | user nginx; |
2 | worker_processes 1; | |
3 | pid /var/run/nginx.pid; | |
4 | ||
5 | events { | |
6 | worker_connections 2048; | |
7 | multi_accept on; | |
8 | use epoll; | |
9 | } | |
10 | ||
11 | http { | |
12 | ||
13 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
14 | '$status $body_bytes_sent "$http_referer" ' | |
15 | '"$http_user_agent" "$http_x_forwarded_for"'; | |
16 | ||
17 | access_log /var/log/nginx/access.log main; | |
18 | ||
19 | server_tokens off; | |
20 | sendfile on; | |
21 | tcp_nopush on; | |
22 | tcp_nodelay on; | |
23 | keepalive_timeout 15; | |
24 | types_hash_max_size 2048; | |
25 | include /etc/nginx/mime.types; | |
26 | default_type application/octet-stream; | |
27 | access_log off; | |
28 | error_log off; | |
29 | gzip on; | |
30 | gzip_disable "msie6"; | |
31 | open_file_cache max=100; | |
32 | ||
33 | ||
34 | upstream php-upstream { | |
35 | server php:9000; | |
36 | } | |
37 | ||
38 | server { | |
39 | #server_name domain.tld www.domain.tld; | |
40 | root /var/www/html/web; | |
41 | ||
42 | location / { | |
43 | # try to serve file directly, fallback to app.php | |
44 | try_files $uri /app.php$is_args$args; | |
45 | } | |
46 | # DEV | |
47 | # This rule should only be placed on your development environment | |
48 | # In production, don't include this and don't deploy app_dev.php or config.php | |
49 | location ~ ^/(app_dev|config)\.php(/|$) { | |
50 | fastcgi_pass php-upstream; | |
51 | fastcgi_split_path_info ^(.+\.php)(/.*)$; | |
52 | include fastcgi_params; | |
53 | # When you are using symlinks to link the document root to the | |
54 | # current version of your application, you should pass the real | |
55 | # application path instead of the path to the symlink to PHP | |
56 | # FPM. | |
57 | # Otherwise, PHP's OPcache may not properly detect changes to | |
58 | # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | |
59 | # for more information). | |
60 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
61 | fastcgi_param DOCUMENT_ROOT $realpath_root; | |
62 | } | |
63 | # PROD | |
64 | location ~ ^/app\.php(/|$) { | |
65 | fastcgi_pass php-upstream; | |
66 | fastcgi_split_path_info ^(.+\.php)(/.*)$; | |
67 | include fastcgi_params; | |
68 | # When you are using symlinks to link the document root to the | |
69 | # current version of your application, you should pass the real | |
70 | # application path instead of the path to the symlink to PHP | |
71 | # FPM. | |
72 | # Otherwise, PHP's OPcache may not properly detect changes to | |
73 | # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 | |
74 | # for more information). | |
75 | fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
76 | fastcgi_param DOCUMENT_ROOT $realpath_root; | |
77 | # Prevents URIs that include the front controller. This will 404: | |
78 | # http://domain.tld/app.php/some-path | |
79 | # Remove the internal directive to allow URIs like this | |
80 | internal; | |
81 | } | |
82 | ||
83 | error_log /var/log/nginx/project_error.log; | |
84 | access_log /var/log/nginx/project_access.log; | |
85 | } | |
86 | ||
87 | } | |
88 | ||
89 | daemon off; |