Skip to content

Instantly share code, notes, and snippets.

@rohanshukla94
Created November 11, 2020 04:09
Show Gist options
  • Save rohanshukla94/88eb5ca2c33f5fc5d14be6695f8cab69 to your computer and use it in GitHub Desktop.
Save rohanshukla94/88eb5ca2c33f5fc5d14be6695f8cab69 to your computer and use it in GitHub Desktop.
Laravel nuxt deployment nginx conf
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 google.com;
root "/var/www/html/project";
index index.php;
# Access Restrictions
allow 127.0.0.1;
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 "/etc/ssl/mycert.crt";
ssl_certificate_key "/etc/ssl/mycert.key";
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
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 http://127.0.0.1:3000; # 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 127.0.0.1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment