Skip to content

Instantly share code, notes, and snippets.



Last active Oct 2, 2019
What would you like to do?
Nginx sites-available config for Nuxt.js and Laravel
map_hash_max_size 262144;
map_hash_bucket_size 262144;
map $sent_http_content_type $expires {
"text/html" epoch;
"text/html; charset=utf-8" epoch;
default off;
server {
listen 80;
listen 443 ssl;
server_name dev.domain.tld;
root "C:/mnt/data/Documents/projects/laravel-oauth/public";
index index.php;
# Access Restrictions
deny all;
location /api {
try_files $uri $uri/ /index.php$is_args$args;
location / {
try_files $uri $uri/ @proxy;
autoindex on;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass php_upstream;
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
# Enable SSL
ssl_certificate "C:/etc/ssl/mycert.crt";
ssl_certificate_key "C:/etc/ssl/mycert.key";
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\.ht {
deny all;
location @proxy {
expires $expires;
add_header Content-Security-Policy "default-src 'self' 'unsafe-inline';";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Cache-Status $upstream_cache_status;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ignore_headers Cache-Control;
proxy_http_version 1.1;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
proxy_pass; # set the adress of the Node.js instance here
#proxy_cache nuxt-cache;
proxy_cache_bypass $arg_nocache; # probably better to change this
proxy_cache_valid 200 302 60m; # set this to your needs
proxy_cache_valid 404 1m; # set this to your needs
proxy_cache_lock on;
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
proxy_cache_key $uri$is_args$args;
#proxy_cache_purge PURGE from;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment