docker container is working
This commit is contained in:
93
nginx.conf
93
nginx.conf
@ -1,67 +1,44 @@
|
||||
# nginx.conf
|
||||
# This file will be mounted into /etc/nginx/conf.d/default.conf inside the container
|
||||
# /etc/nginx/conf.d/default.conf
|
||||
# This file is mounted into the container at the same location.
|
||||
|
||||
# Enable proxy buffers (optional but recommended)
|
||||
proxy_buffering on;
|
||||
proxy_buffers 16 16k;
|
||||
proxy_buffer_size 32k;
|
||||
# ------------------------------------------------------------------
|
||||
# 1. Common proxy-headers (set once, use everywhere)
|
||||
# ------------------------------------------------------------------
|
||||
# These are forwarded to *every* upstream that Nginx talks to.
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 2. Server block
|
||||
# ------------------------------------------------------------------
|
||||
server {
|
||||
listen 80;
|
||||
server_name pwdgwn_v2;
|
||||
listen 80 default_server;
|
||||
server_name _; # Catch-all - change to your domain if you need a specific name.
|
||||
|
||||
# ---------------------------------------
|
||||
# API Routes
|
||||
# ---------------------------------------
|
||||
location = /get_password {
|
||||
proxy_pass http://localhost:5000/get_password;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# ------------------------------------------------------------------
|
||||
# 3. API routes - all hit the same Flask app (localhost:5000)
|
||||
# ------------------------------------------------------------------
|
||||
# A single location with a regex is cleaner than five almost-identical
|
||||
# blocks. The regex matches the exact paths you listed.
|
||||
location ~ ^/(get_password|verbose_password|custom_password|get_count|get_info)$ {
|
||||
proxy_pass http://localhost:5000; # Forward *exactly* the same URI
|
||||
proxy_redirect off; # Preserve any redirects from Flask
|
||||
}
|
||||
|
||||
location = /verbose_password {
|
||||
proxy_pass http://localhost:5000/verbose_password;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location = /custom_password {
|
||||
proxy_pass http://localhost:5000/custom_password;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location = /get_count {
|
||||
proxy_pass http://localhost:5000/get_count;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location = /get_info {
|
||||
proxy_pass http://localhost:5000/get_info;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# ---------------------------------------
|
||||
# All other paths → Apache (PHP)
|
||||
# ---------------------------------------
|
||||
# ------------------------------------------------------------------
|
||||
# 4. All other requests go to Apache/PHP (localhost:8080)
|
||||
# ------------------------------------------------------------------
|
||||
location / {
|
||||
proxy_pass http://localhost:8080;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://localhost:8080;
|
||||
proxy_redirect off; # (optional but safe)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# 5. Optional timeout tuning - adjust to your workload
|
||||
# ------------------------------------------------------------------
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_send_timeout 60s;
|
||||
proxy_read_timeout 60s;
|
||||
}
|
||||
Reference in New Issue
Block a user