import asyncio
from fastapi import FastAPI
from app.core.server import Server
from app.core.startup_tasks import start_periodic_tasks
from prometheus_fastapi_instrumentator import Instrumentator
app = FastAPI(debug=True)
server = Server(app)
application = server.get_app()
production_instrumentator = Instrumentator(
should_group_status_codes=False,
should_ignore_untemplated=True,
should_respect_env_var=False,
should_instrument_requests_inprogress=True,
excluded_handlers=[".admin.", "/metrics", ],
env_var_name="ENABLE_METRICS",
inprogress_name="inprogress",
inprogress_labels=True
)
production_instrumentator.instrument(application).expose(application, endpoint="/metrics")
this is my code it works on localhost but now working on server even i tryed to add from nginx conf also
server{
server_name mydomain.com;
client_max_body_size 500M;
location / {
include proxy_params;
proxy_pass http://127.0.0.1:8008;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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 /metrics{
proxy_pass http://127.0.0.1:8008/metrics;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/api.ilmiyish.uz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/api.ilmiyish.uz/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server{
if ($host = mydomain.com) {
return 301 https://$host$request_uri;
}
server_name mydomain.com;
listen 80;
return 404;
}
help me guys if you know what mistake i did
import asyncio
from fastapi import FastAPI
from app.core.server import Server
from app.core.startup_tasks import start_periodic_tasks
from prometheus_fastapi_instrumentator import Instrumentator
app = FastAPI(debug=True)
server = Server(app)
application = server.get_app()
production_instrumentator = Instrumentator(
should_group_status_codes=False,
should_ignore_untemplated=True,
should_respect_env_var=False,
should_instrument_requests_inprogress=True,
excluded_handlers=[".admin.", "/metrics", ],
env_var_name="ENABLE_METRICS",
inprogress_name="inprogress",
inprogress_labels=True
)
production_instrumentator.instrument(application).expose(application, endpoint="/metrics")
this is my code it works on localhost but now working on server even i tryed to add from nginx conf also
server{
server_name mydomain.com;
client_max_body_size 500M;
location / {
include proxy_params;
proxy_pass http://127.0.0.1:8008;
}
server{
if ($host = mydomain.com) {
return 301 https://$host$request_uri;
}
}
help me guys if you know what mistake i did