Add requirements for dockerization

This commit is contained in:
Michele Rossi
2026-01-08 08:37:38 +01:00
parent 617ff597dd
commit 4af3812983
2 changed files with 49 additions and 0 deletions

18
Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM nginx:latest
# Remove the default Nginx configuration file
RUN rm /etc/nginx/conf.d/default.conf
# Copy our custom configuration
COPY nginx.conf /etc/nginx/conf.d/jmpgames.conf
# Create the directory and copy website files
# Ensure the folder structure matches your 'root' directive in nginx.conf
WORKDIR /var/www/jmpgames.it
COPY..
# Fix permissions so Nginx can read the files
RUN chown -R nginx:nginx /var/www/jmpgames.it && \
chmod -R 755 /var/www/jmpgames.it
# Expose port 80 (internal container port)
EXPOSE 80

31
nginx.conf Normal file
View File

@@ -0,0 +1,31 @@
server {
listen 80;
server_name jmpgames.it www.jmpgames.it;
# Serve static files
root /var/www/jmpgames.it;
index index.html;
# Logging: We use the default paths so they output to Docker logs (stdout/stderr)
# This allows 'homepage' and 'fail2ban' to monitor them easily.
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Performance: Enable Gzip
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Security: Hide Nginx version number
server_tokens off;
location / {
# First attempt to serve request as file, then as directory, then 404
try_files $uri $uri/ =404;
}
# Cache settings for static assets (images, css, js)
location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
}