Skip to content

Instantly share code, notes, and snippets.

@shareefhiasat
Last active December 26, 2023 05:40
Show Gist options
  • Save shareefhiasat/6a9a4b0707c4e80d0cecb3bfa11b3b9a to your computer and use it in GitHub Desktop.
Save shareefhiasat/6a9a4b0707c4e80d0cecb3bfa11b3b9a to your computer and use it in GitHub Desktop.
docker configuration with default minimum nginx configuration with port 80
version: "1.0"
services:
nginx:
image: nginx:latest
restart: unless-stopped
volumes:
- .\config\nginx.conf:/etc/nginx/nginx.conf
- .\logs:/var/log/nginx
- .\html:/var/www/html
ports:
- "80:80"
#- "443:443"
<html>
<body>
<h1>it's working</h1>
</body>
</html>
# Define the events block
events {
worker_connections 1024;
}
# Define the HTTP server block
http {
# Set the MIME type for files
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Define the log format
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# Define the access log file and the log level
access_log /var/log/nginx/access.log main;
# Define the server block for port 80
server {
# Listen on port 80
listen 80;
# Define the server_name (can be a domain name or IP address)
server_name localhost;
# Define the location of the root directory
root /var/www/html;
# Specify the default file (index.html)
index index.html;
# Define the location block for serving static files
location / {
try_files $uri $uri/ =404;
}
}
}
@shareefhiasat
Copy link
Author

shareefhiasat commented Dec 26, 2023

This is tested and working on 26-12-2023
You will need 3 folders
config
html
logs

on my windows in my case 🔼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment