2016-07-14 04:12:58 -04:00
|
|
|
worker_processes auto;
|
2016-09-25 05:22:48 -04:00
|
|
|
pid /tmp/nginx.pid;
|
2016-07-14 04:12:58 -04:00
|
|
|
daemon off;
|
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
use epoll;
|
|
|
|
}
|
|
|
|
|
|
|
|
http {
|
2016-09-25 05:22:48 -04:00
|
|
|
|
2016-07-14 04:12:58 -04:00
|
|
|
include /etc/nginx/mime.types;
|
2016-09-25 05:22:48 -04:00
|
|
|
default_type application/octet-stream;
|
2016-07-14 04:12:58 -04:00
|
|
|
|
|
|
|
access_log off;
|
2016-09-25 05:22:48 -04:00
|
|
|
error_log /tmp/ngx_error.log error;
|
2016-07-14 04:12:58 -04:00
|
|
|
|
|
|
|
sendfile on;
|
|
|
|
keepalive_timeout 15;
|
|
|
|
keepalive_disable msie6;
|
|
|
|
keepalive_requests 100;
|
|
|
|
tcp_nopush on;
|
|
|
|
tcp_nodelay on;
|
|
|
|
server_tokens off;
|
|
|
|
|
2016-09-25 05:22:48 -04:00
|
|
|
fastcgi_temp_path /tmp/fastcgi 1 2;
|
|
|
|
client_body_temp_path /tmp/client_body 1 2;
|
|
|
|
proxy_temp_path /tmp/proxy 1 2;
|
|
|
|
uwsgi_temp_path /tmp/uwsgi 1 2;
|
|
|
|
scgi_temp_path /tmp/scgi 1 2;
|
|
|
|
|
2016-07-14 04:12:58 -04:00
|
|
|
gzip on;
|
|
|
|
gzip_comp_level 5;
|
|
|
|
gzip_min_length 512;
|
|
|
|
gzip_buffers 4 8k;
|
|
|
|
gzip_proxied any;
|
|
|
|
gzip_vary on;
|
|
|
|
gzip_disable "msie6";
|
|
|
|
gzip_types
|
|
|
|
text/css
|
|
|
|
text/javascript
|
|
|
|
text/xml
|
|
|
|
text/plain
|
|
|
|
text/x-component
|
|
|
|
application/javascript
|
|
|
|
application/x-javascript
|
|
|
|
application/json
|
|
|
|
application/xml
|
|
|
|
application/rss+xml
|
|
|
|
application/vnd.ms-fontobject
|
|
|
|
font/truetype
|
|
|
|
font/opentype
|
|
|
|
image/svg+xml;
|
|
|
|
|
|
|
|
server {
|
2016-09-25 05:22:48 -04:00
|
|
|
|
|
|
|
listen 8888;
|
2016-07-23 02:44:00 -04:00
|
|
|
root /flarum/app;
|
2016-07-14 04:12:58 -04:00
|
|
|
index index.php;
|
|
|
|
charset utf-8;
|
2016-10-29 13:36:42 -04:00
|
|
|
|
2016-09-25 05:22:48 -04:00
|
|
|
client_max_body_size 50M;
|
2016-10-29 13:36:42 -04:00
|
|
|
fastcgi_buffers 64 4K;
|
2016-07-14 04:12:58 -04:00
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
error_page 403 /403.html;
|
|
|
|
error_page 404 /404.html;
|
|
|
|
error_page 500 /500.html;
|
|
|
|
error_page 503 /503.html;
|
|
|
|
|
|
|
|
location = /403.html { root /flarum/app/vendor/flarum/core/error; }
|
|
|
|
location = /404.html { root /flarum/app/vendor/flarum/core/error; }
|
|
|
|
location = /500.html { root /flarum/app/vendor/flarum/core/error; }
|
|
|
|
location = /503.html { root /flarum/app/vendor/flarum/core/error; }
|
|
|
|
|
|
|
|
location / { try_files $uri $uri/ /index.php?$query_string; }
|
|
|
|
location /api { try_files $uri $uri/ /api.php?$query_string; }
|
|
|
|
location /admin { try_files $uri $uri/ /admin.php?$query_string; }
|
2016-07-14 04:12:58 -04:00
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
# Access path list
|
|
|
|
# --------------------------------------
|
|
|
|
location ~ /\. {
|
|
|
|
deny all;
|
|
|
|
return 404;
|
2016-07-14 04:12:58 -04:00
|
|
|
}
|
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
location ~* ^/(Procfile|storage|Vagrantfile|config\.php|LICENSE|vendor|flarum|scripts) {
|
|
|
|
deny all;
|
|
|
|
return 404;
|
2016-07-14 04:12:58 -04:00
|
|
|
}
|
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
location ~* composer(.*?) {
|
2016-09-25 05:22:48 -04:00
|
|
|
deny all;
|
|
|
|
return 404;
|
|
|
|
}
|
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
location ~* (.*?)\.md {
|
|
|
|
deny all;
|
|
|
|
return 404;
|
2016-07-14 04:12:58 -04:00
|
|
|
}
|
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
# Assets cache control
|
|
|
|
# --------------------------------------
|
|
|
|
location ~* \.(?:html|xml|json)$ {
|
2016-09-25 05:22:48 -04:00
|
|
|
expires -1;
|
2016-07-14 04:12:58 -04:00
|
|
|
}
|
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
location ~* \.(?:css|js)$ {
|
|
|
|
expires 7d;
|
|
|
|
add_header Pragma public;
|
|
|
|
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~* \.(?:gif|jpe?g|png|ico|otf|eot|svg|ttf|woff|woff2)$ {
|
|
|
|
expires 30d;
|
2016-09-25 05:22:48 -04:00
|
|
|
add_header Pragma public;
|
|
|
|
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
|
2016-07-14 04:12:58 -04:00
|
|
|
}
|
|
|
|
|
2016-10-29 13:36:42 -04:00
|
|
|
# PHP Backend
|
|
|
|
# --------------------------------------
|
2016-09-25 05:22:48 -04:00
|
|
|
location ~* \.php$ {
|
2016-10-29 13:36:42 -04:00
|
|
|
try_files $uri =404;
|
2016-09-25 05:22:48 -04:00
|
|
|
include fastcgi_params;
|
2016-10-29 13:36:42 -04:00
|
|
|
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
2016-09-25 05:22:48 -04:00
|
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
2016-10-29 13:36:42 -04:00
|
|
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
2016-09-25 05:22:48 -04:00
|
|
|
fastcgi_param HTTP_PROXY "";
|
|
|
|
fastcgi_index index.php;
|
2016-10-29 13:36:42 -04:00
|
|
|
fastcgi_pass unix:/tmp/php-fpm.sock;
|
|
|
|
fastcgi_intercept_errors on;
|
|
|
|
fastcgi_request_buffering off;
|
2016-07-14 04:12:58 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|