GWibisono

backend.yaml

Apr 18th, 2026
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.80 KB | Source Code | 0 0
  1. version: '3'
  2. services:
  3.  # Server API
  4.   server-api:
  5.     image: localhost/my-php-nginx
  6.     container_name: api_container
  7.     user: "0:0" # Menjalankan sebagai root:root internal
  8.     userns_mode: "keep-id:uid=33,gid=33"
  9.     ports:
  10.      - "8101:80"
  11.     volumes:
  12.      - ./html:/var/www/html:Z
  13.       - ./configs/def.conf:/etc/nginx/sites-enabled/default:ro # Hapus .conf
  14.       - ./logs:/var/log/nginx             # Folder Log (Read-Write)
  15.     networks:
  16.      - shared_net
  17. #    configs:
  18. #      - source: nginx_config
  19. #        target: /etc/nginx/sites-enabled/default.conf
  20. #    depends_on:
  21. #      - database-maria-1
  22. #      - database-maria-2
  23. #      - database-postgres
  24.  
  25. networks:
  26.   shared_net:
  27.     external: true
  28.     name: shared_network
  29.    
  30. configs:
  31.   nginx_config:
  32.     inline: |
  33.      server {
  34.           listen 80;
  35.           server_name localhost;
  36.           root /var/www/html;
  37.  
  38.           access_log /var/log/nginx/access.log;
  39.           error_log  /var/log/nginx/error.log;
  40.  
  41.           charset utf-8;
  42.  
  43.           location / {
  44.               index index.php index.html index.htm;
  45.               try_files $uri $uri/ /index.php?$query_string;
  46.           }
  47.  
  48.           location ~ \.php$ {
  49.               fastcgi_pass   127.0.0.1:9000;
  50.               fastcgi_index  index.php;
  51.               include        fastcgi_params;
  52.               fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
  53.              
  54.               fastcgi_intercept_errors off;
  55.               fastcgi_buffer_size 16k;
  56.               fastcgi_buffers 4 16k;
  57.           }
  58.  
  59.           location ~ /\.ht {
  60.               deny all;
  61.           }
  62.  
  63.           location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
  64.               expires max;
  65.               log_not_found off;
  66.               access_log off;
  67.           }
  68.       }
Advertisement
Add Comment
Please, Sign In to add comment