L
L
LionG2021-01-25 11:25:21
Nginx
LionG, 2021-01-25 11:25:21

NGINX reverse_proxy does not return static if logs are disabled, where is the bug?

Created a web compose with NGINX containers and PHPMyAdmin (apache+ftp=1 port). I want to install PHPMyAdmin on pma.site.ru subdomain. To do this, I set up a reverse proxy, the server responds, and the statics 404. Experimentally, it turned out that if you disable the config responsible for managing static logs and compression, everything works.
The config was generated by nginxconfig.io and partially redone for the needs.

site.ru.conf

#PMA
server {
    listen                  443 ssl http2;
    listen                  [::]:443 ssl http2;
    server_name             pma.site.ru;

    # SSL
    ssl_certificate         /etc/letsencrypt/live/site.ru/fullchain.pem;
    ssl_certificate_key     /etc/letsencrypt/live/site.ru/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/site.ru/chain.pem;

    # security
    include                 nginxconfig.io/security.conf;

    # logging
    access_log              /var/www/pma.site.ru/.logs/access.log;
    error_log               /var/www/pma.site.ru/.logs/error.log warn;

    location / {
        proxy_pass http://phpmyadmin:80;
        #proxy
        include nginxconfig.io/proxy.conf;
    }

    # additional config
    # include nginxconfig.io/general.conf;
}


general.conf
# favicon.ico
location = /favicon.ico {
    log_not_found off;
    access_log    off;
}

# robots.txt
location = /robots.txt {
    log_not_found off;
    access_log    off;
}

# assets, media
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
    expires    7d;
    access_log off;
}

# svg, fonts
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
    add_header Access-Control-Allow-Origin "*";
    expires    7d;
    access_log off;
}

# gzip
gzip              on;
gzip_vary         on;
gzip_proxied      any;
gzip_comp_level   6;
gzip_types        text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;


NGINX seems to start looking for statics no longer by proxy_pass, but in root (and maybe it’s not specified by default and of course it doesn’t find it).

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question