-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
58 lines (50 loc) · 1.83 KB
/
nginx.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
server {
listen [::]:8080 default_server;
listen 8080 default_server;
server_name _;
sendfile off;
tcp_nodelay on;
absolute_redirect off;
# set the root directory for the server (we need to copy our
# application files here)
root /usr/share/nginx/html;
# set the default index file for the server (Angular generates the
# index.html file for us and it will be in the above directory)
index index.html;
# specify the configuration for the '/' location
location / {
# try to serve the requested URI. if that fails then try to
# serve the URI with a trailing slash. if that fails, then
# serve the index.html file; this is needed in order to serve
# Angular routes--e.g.,'localhost:8080/customer' will serve
# the index.html file
try_files $uri $uri/ /index.html;
}
# Pass the PHP scripts to PHP-FPM listening on php-fpm.sock
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
# Set the cache-control headers on assets to cache for 5 days
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
expires 5d;
}
# Deny access to . files, for security
location ~ /\. {
log_not_found off;
deny all;
}
# Allow fpm ping and status from localhost
location ~ ^/(fpm-status|fpm-ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_pass unix:/run/php-fpm.sock;
}
}