a
This commit is contained in:
35
nginx.conf
35
nginx.conf
@@ -1,26 +1,37 @@
|
|||||||
server {
|
server {
|
||||||
listen 8097;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index index.html index.htm index.php;
|
index index.html index.htm index.php;
|
||||||
|
|
||||||
location / {
|
# Handle src directory (for your TypeScript/React files)
|
||||||
try_files $uri $uri/ =404;
|
location /src/ {
|
||||||
|
try_files $uri =404;
|
||||||
|
# Add MIME type for .tsx files if needed
|
||||||
|
location ~* \.(tsx|ts)$ {
|
||||||
|
add_header Content-Type application/javascript;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Enable gzip compression
|
# Handle public directory assets
|
||||||
gzip on;
|
location /public/ {
|
||||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
# Cache static assets
|
# Handle root-level requests for public assets (like /felo-icon.svg)
|
||||||
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
location ~ \.(ico|svg|png|jpg|jpeg|gif|css|js|woff|woff2|ttf|eot)$ {
|
||||||
|
# Try the file directly, then in public folder
|
||||||
|
try_files $uri /public$uri =404;
|
||||||
expires 1y;
|
expires 1y;
|
||||||
add_header Cache-Control "public, immutable";
|
add_header Cache-Control "public, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Security headers
|
# Default location for everything else
|
||||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
location / {
|
||||||
add_header X-Content-Type-Options "nosniff" always;
|
try_files $uri $uri/ =404;
|
||||||
add_header X-XSS-Protection "1; mode=block" always;
|
}
|
||||||
|
|
||||||
|
gzip on;
|
||||||
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user