Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
base Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TokaKaram
base Project
Commits
ba561e03
Commit
ba561e03
authored
Dec 07, 2025
by
salma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updaye nginx.conf
parent
b3495679
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
14 deletions
+66
-14
Dockerfile
Dockerfile
+7
-1
nginx.conf
nginx.conf
+59
-13
No files found.
Dockerfile
View file @
ba561e03
FROM
nginx:alpine
FROM
nginx:alpine
# 1. Remove default Nginx config
RUN
rm
/etc/nginx/conf.d/default.conf
RUN
rm
/etc/nginx/conf.d/default.conf
COPY
nginx.conf /etc/nginx/conf.d/default.conf
# 2. Copy OUR optimized Global Nginx config
# (Make sure nginx.conf is in the same folder as this Dockerfile)
COPY
nginx.conf /etc/nginx/nginx.conf
# 3. Copy your website files
COPY
. /usr/share/nginx/html/
COPY
. /usr/share/nginx/html/
EXPOSE
80
EXPOSE
80
...
...
nginx.conf
View file @
ba561e03
server
{
worker_processes
auto
;
listen
80
;
worker_rlimit_nofile
65535
;
# Allow Nginx to open many files
events
{
worker_connections
10240
;
# Allow 10k connections per worker
multi_accept
on
;
# Accept all new connections at once
use
epoll
;
# Efficient event processing on Linux
}
http
{
include
/etc/nginx/mime.types
;
default_type
application/octet-stream
;
# LOGGING: Disable access logs during stress test to save Disk I/O
access_log
off
;
error_log
/var/log/nginx/error.log
crit
;
# OPTIMIZATIONS
sendfile
on
;
tcp_nopush
on
;
tcp_nodelay
on
;
keepalive_timeout
65
;
keepalive_requests
100000
;
reset_timedout_connection
on
;
# TIMEOUTS (Don't keep dead connections open)
client_body_timeout
10
;
send_timeout
2
;
# The root directory for your files inside the container
# GZIP COMPRESSION (Reduces bandwidth usage)
gzip
on
;
gzip_min_length
10240
;
gzip_proxied
expired
no-cache
no-store
private
auth
;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/x-javascript
application/xml
;
gzip_disable
"MSIE
[1-6]
\
."
;
# OPEN FILE CACHE (Crucial for static sites)
# Caches file descriptors so Nginx doesn't read the disk for every request
open_file_cache
max=200000
inactive=20s
;
open_file_cache_valid
30s
;
open_file_cache_min_uses
2
;
open_file_cache_errors
on
;
server
{
listen
80
;
server_name
localhost
;
root
/usr/share/nginx/html
;
root
/usr/share/nginx/html
;
index
index.html
;
index
index.html
;
# This is important: it ensures that if you refresh a page on a
# specific route, it doesn't give a 404 error. It will always
# serve the index.html file, allowing your frontend routing to work.
location
/
{
location
/
{
try_files
$uri
$uri
/
/index.html
;
try_files
$uri
$uri
/
/index.html
;
}
}
# Cache images aggressively in the browser to save bandwidth
location
~
*
\
.(jpg|jpeg|png|gif|ico|css|js)
$
{
expires
30d
;
add_header
Cache-Control
"public,
no-transform"
;
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment