-
Notifications
You must be signed in to change notification settings - Fork 1
/
nginx.conf
89 lines (74 loc) · 2.42 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# A sample Nginx configuration for Lightweight CMS based sites.
#
# Don't simply copy and paste the configuration here. Instead,
# modify it according to your own situations.
server {
# The port of your server.
listen 3000;
# The domain name of your server.
server_name localhost;
# If your Nginx serves a HTTPS site,
# SSL related configuration are mandatory.
#
# You may get a free SSL certificate at
# Let's Encrypt (https://letsencrypt.org/).
#
#ssl_certificate /path/to/site.crt;
#ssl_certificate_key /path/to/site.key;
#ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
#ssl_ciphers HIGH:!aNULL:!MD5;
# Route to assets.
#
# You may require to set various expiration times
# for different assets. If the case, set
# separate assets in distinct `location` blocks.
#
location ~ \.(css|js|json|xml|txt|jpg|jpeg|png|gif|woff|woff2)$ {
root /var/www/lightweight-cms/public/;
}
# You should always prepare a HTTP 404 page
# to hide sensitive system information.
#
error_page 404 /404.html;
# In a similiar fashion, you should prepare
# a HTTP 50x page as well.
#
error_page 500 502 503 504 /50x.html;
# Route to static error pages.
#
# The page is prerendered by our custom script.
# Therefore, it is static.
#
location ~ /(404|50x).html {
root /var/www/lightweight-cms/public/;
}
# Route to all URLs except assets.
location / {
root /var/www/lightweight-cms/www/;
# Try local files first. If none is matched,
# rewrite the URL to our index script.
try_files $uri $uri.php $uri.html $uri.htm @rewrite;
}
# Redirect all URLs to our index script.
#
# Currently, we don't handle URL parameters at all.
#
location @rewrite {
rewrite ^(.+)$ /index.php;
}
# Pass PHP scripts to a FastCGI server.
location ~ \.php$ {
root /var/www/lightweight-cms/www/;
# Listen to a local server.
#fastcgi_pass 127.0.0.1:9000;
# Listen to a socket.
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# Disallow access to Apache configuration files.
location ~ /\.ht {
deny all;
}
}