/
nginx.conf
89 lines (70 loc) · 2.38 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 sites on Laragon.
#
# Don't simply copy and paste the configuration here. Instead,
# modify it according to your own situations.
server {
listen 80 default_server;
server_name localhost ;
root "C:/laragon/www/lightweight-cms/";
#index index.html index.htm index.php;
# Access Restrictions
allow 127.0.0.1;
deny all;
include "C:/laragon/etc/nginx/alias/*.conf";
# 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 C:/laragon/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 C:/laragon/www/lightweight-cms/public/;
}
# Route to all URLs except assets.
location / {
root C:/laragon/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 C:/laragon/www/lightweight-cms/www/;
#include snippets/fastcgi-php.conf;
fastcgi_pass php_upstream;
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
# Disallow access to Apache configuration files.
location ~ /\.ht {
deny all;
}
}