server icon indicating copy to clipboard operation
server copied to clipboard

Feature Request: Add error.log and access.log to Nginx

Open digitalbirth opened this issue 1 year ago • 1 comments

To help assist others in troubleshooting their installations, it may help to make it easy to enable logging for the nginx server.

It should be commented out by default so the logs don't grow in size, but should be an easy option to enable if required.

nginx.conf

Add lines: " #access_log /var/log/nginx/access.log; #error_log /var/log/nginx/error.log warn; "

server {
   listen 80;
   listen [::]:80;
   server_name _;

   client_max_body_size 4G;

  # Logs - uncomment to enable location:/mergin/logs
  # If enabled be aware of disk space used by the logs.
   #access_log /var/log/nginx/access.log;
   #error_log /var/log/nginx/error.log warn;

docker-compose.yml

add line: " - ./logs:/var/log/nginx/"

proxy:
    image: nginx
    container_name: merginmaps-proxy
    restart: always
    ports:
      - "8080:80"
    volumes:
      - ./projects:/data  # map data dir to host
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
      - ./logs:/var/log/nginx/  # map logs dir to host

digitalbirth avatar Jan 15 '24 11:01 digitalbirth