a
This commit is contained in:
35
nginx.conf
35
nginx.conf
@@ -1,26 +1,37 @@
|
||||
server {
|
||||
listen 8097;
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
# Handle src directory (for your TypeScript/React files)
|
||||
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
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
# Handle public directory assets
|
||||
location /public/ {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
# Cache static assets
|
||||
location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
# Handle root-level requests for public assets (like /felo-icon.svg)
|
||||
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;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Security headers
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header X-XSS-Protection "1; mode=block" always;
|
||||
# Default location for everything else
|
||||
location / {
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
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