Add hosting configuration

This commit is contained in:
2025-07-25 01:08:06 +00:00
parent 17ce7f6ef6
commit 277e425332
3 changed files with 65 additions and 0 deletions

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
# .dockerignore
node_modules/
.git/
.DS_Store
docker-compose.yml
*.md

23
Dockerfile Normal file
View File

@@ -0,0 +1,23 @@
#FROM node:20 AS build
#WORKDIR /app
#COPY package.json package-lock.json ./
#RUN npm install
#COPY . .
#RUN npm run build
FROM nginx:alpine
#COPY --from=build /app/build /usr/share/nginx/html
COPY ./dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

36
nginx.conf Normal file
View File

@@ -0,0 +1,36 @@
server {
listen 80;
server_name aypos.blc-css.com; # Replace with your domain or IP
root /usr/share/nginx/html; # Path to your built files
index index.html;
# Serve static files directly
location / {
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://aypos-api.blc-css.com:8003/; # Proxy to your API subdomain
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;
}
# Optional: Add gzip compression for better performance
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Optional: Add security headers (adjust as needed)
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
# Optional: Cache static assets aggressively
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
try_files $uri =404;
}
}