Files
cicd/playbooks/roles/nginx-reconfigure2/files/nginx/nginx.conf
2025-07-20 14:53:12 +03:00

108 lines
2.4 KiB
Nginx Configuration File

# user nginx;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
proxy_cache_path /tmp/cache keys_zone=my_cache:10m max_size=1g inactive=60m use_temp_path=off;
client_max_body_size 100M;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_min_length 1000;
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=5r/s;
upstream web_backend {
least_conn;
server web_backend1:5000;
server web_backend2:5000;
}
upstream gitea {
least_conn;
server gitea:3000;
}
upstream drone {
least_conn;
server drone:80;
}
server {
listen 9888;
server_name localhost;
location /nginx_status {
stub_status;
# allow 127.0.0.1;
# allow 172.18.0.0/16;
# deny all;
}
}
server {
listen 80;
server_name git.roniss0505.tech;
include /etc/nginx/shared_locations.conf;
location / {
proxy_pass http://gitea;
include /etc/nginx/proxy_common.conf;
error_page 502 504 /server_not_available.html;
}
}
server {
listen 80;
server_name roniss0505.tech;
include /etc/nginx/shared_locations.conf;
location / {
proxy_pass http://drone;
include /etc/nginx/proxy_common.conf;
error_page 502 504 /server_not_available.html;
}
}
server {
listen 80;
server_name drone.roniss0505.tech;
include /etc/nginx/shared_locations.conf;
location /api/ {
rewrite ^/api/(.*)$ /$1 break; #deleting "/api/" from path
proxy_pass http://web_backend;
# proxy_cache my_cache;
# proxy_cache_valid 200 1h;
# proxy_cache_valid 404 1m;
include /etc/nginx/proxy_common.conf;
error_page 502 504 /server_not_available.html;
}
}
}