Spaces:
Sleeping
Sleeping
Commit
·
da84348
1
Parent(s):
0abb0ed
More nginx configuration
Browse files- Dockerfile +4 -1
- nginx.conf +38 -0
Dockerfile
CHANGED
|
@@ -2,13 +2,16 @@
|
|
| 2 |
FROM nginx:alpine
|
| 3 |
|
| 4 |
# Create necessary directories and set permissions
|
| 5 |
-
RUN mkdir -p /var/cache/nginx/client_temp && \
|
| 6 |
chown -R nginx:nginx /var/cache/nginx && \
|
| 7 |
chmod -R 755 /var/cache/nginx
|
| 8 |
|
| 9 |
# Copy the HTML file to the Nginx default directory
|
| 10 |
COPY index.html /usr/share/nginx/html
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
# Expose port 80 to allow external access
|
| 13 |
EXPOSE 80
|
| 14 |
|
|
|
|
| 2 |
FROM nginx:alpine
|
| 3 |
|
| 4 |
# Create necessary directories and set permissions
|
| 5 |
+
RUN mkdir -p /var/cache/nginx/client_temp /var/cache/nginx/proxy_temp /var/cache/nginx/fastcgi_temp /var/cache/nginx/uwsgi_temp /var/cache/nginx/scgi_temp && \
|
| 6 |
chown -R nginx:nginx /var/cache/nginx && \
|
| 7 |
chmod -R 755 /var/cache/nginx
|
| 8 |
|
| 9 |
# Copy the HTML file to the Nginx default directory
|
| 10 |
COPY index.html /usr/share/nginx/html
|
| 11 |
|
| 12 |
+
# Copy a custom Nginx configuration file
|
| 13 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
| 14 |
+
|
| 15 |
# Expose port 80 to allow external access
|
| 16 |
EXPOSE 80
|
| 17 |
|
nginx.conf
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
user nginx;
|
| 2 |
+
worker_processes auto;
|
| 3 |
+
|
| 4 |
+
error_log /var/log/nginx/error.log warn;
|
| 5 |
+
pid /var/run/nginx.pid;
|
| 6 |
+
|
| 7 |
+
events {
|
| 8 |
+
worker_connections 1024;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
http {
|
| 12 |
+
include /etc/nginx/mime.types;
|
| 13 |
+
default_type application/octet-stream;
|
| 14 |
+
|
| 15 |
+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
| 16 |
+
'$status $body_bytes_sent "$http_referer" '
|
| 17 |
+
'"$http_user_agent" "$http_x_forwarded_for"';
|
| 18 |
+
|
| 19 |
+
access_log /var/log/nginx/access.log main;
|
| 20 |
+
|
| 21 |
+
sendfile on;
|
| 22 |
+
keepalive_timeout 65;
|
| 23 |
+
|
| 24 |
+
server {
|
| 25 |
+
listen 80;
|
| 26 |
+
server_name localhost;
|
| 27 |
+
|
| 28 |
+
location / {
|
| 29 |
+
root /usr/share/nginx/html;
|
| 30 |
+
index index.html index.htm;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
error_page 500 502 503 504 /50x.html;
|
| 34 |
+
location = /50x.html {
|
| 35 |
+
root /usr/share/nginx/html;
|
| 36 |
+
}
|
| 37 |
+
}
|
| 38 |
+
}
|