update nginx.config
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.idea
|
||||||
34
nginx.config
34
nginx.config
@@ -6,18 +6,15 @@ server {
|
|||||||
return 301 https://nkode.tech$request_uri;
|
return 301 https://nkode.tech$request_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Redirect HTTP to HTTPS for nkode.tech
|
||||||
server {
|
server {
|
||||||
listen 443 ssl http2;
|
listen 80;
|
||||||
server_name www.nkode.tech;
|
server_name nkode.tech;
|
||||||
|
|
||||||
ssl_certificate /etc/letsencrypt/live/nkode.tech/fullchain.pem;
|
return 301 https://$host$request_uri;
|
||||||
ssl_certificate_key /etc/letsencrypt/live/nkode.tech/privkey.pem;
|
|
||||||
ssl_trusted_certificate /etc/letsencrypt/live/nkode.tech/chain.pem;
|
|
||||||
|
|
||||||
return 301 https://nkode.tech$request_uri;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main server block for nkode.tech
|
# Main server block for nkode.tech with SSL and content configuration
|
||||||
server {
|
server {
|
||||||
listen 443 ssl http2;
|
listen 443 ssl http2;
|
||||||
server_name nkode.tech;
|
server_name nkode.tech;
|
||||||
@@ -43,12 +40,20 @@ server {
|
|||||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
|
||||||
|
|
||||||
root /var/www/webapp;
|
root /var/www/webapp;
|
||||||
index index.html index.htm;
|
index index.html;
|
||||||
|
|
||||||
|
# Routing for Flutter SPA
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.html;
|
try_files $uri $uri/ /index.html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Caching for Static Assets
|
||||||
|
location ~* \.(?:js|css|png|jpg|jpeg|gif|svg|ico|woff2?)$ {
|
||||||
|
expires 1y;
|
||||||
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Error pages
|
||||||
error_page 404 /404.html;
|
error_page 404 /404.html;
|
||||||
location = /404.html {
|
location = /404.html {
|
||||||
root /var/www/webapp;
|
root /var/www/webapp;
|
||||||
@@ -58,12 +63,9 @@ server {
|
|||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
root /var/www/webapp;
|
root /var/www/webapp;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
# Redirect HTTP to HTTPS for nkode.tech
|
# Optional: Enable Gzip Compression
|
||||||
server {
|
gzip on;
|
||||||
listen 80;
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
server_name nkode.tech;
|
gzip_min_length 256;
|
||||||
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user