Skip to content

Instantly share code, notes, and snippets.

@Yiddishe-Kop
Last active September 29, 2020 11:22
Show Gist options
  • Save Yiddishe-Kop/61ff1140e97d393d4da6c0ad6d7a4518 to your computer and use it in GitHub Desktop.
Save Yiddishe-Kop/61ff1140e97d393d4da6c0ad6d7a4518 to your computer and use it in GitHub Desktop.
Multiple Laravel applications on one server nginx configuration
# Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
~font/ max;
application/octet-stream max;
}
server {
server_name pninim.yiddishe-kop.com;
root /var/www/pninim-app/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log logs/pninim.access.log compression buffer=32k;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
# set cache-control headers
expires $expires;
# use gzip
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/pninim.yiddishe-kop.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/pninim.yiddishe-kop.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = pninim.yiddishe-kop.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name pninim.yiddishe-kop.com;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment