T
T
Turbotash2022-03-20 19:40:30
PHP
Turbotash, 2022-03-20 19:40:30

Pictures of examle.com do not open on port 80, but on 8080 everything is OK, how to fix it?

Good afternoon, I need your help
Deployed NGINX + apache. Apache listens on 8080, nginx 80 respectively. Everything lies on Centos 8.
The essence of the problem:
There is a script of a kind of news feed.
Uploading a picture
On port 8080 at Apache, the picture is displayed (conditionally domain.ru: 8080)
And on port 80 it is not displayed (domain.ru / domain.ru:80)
1. I upload the picture to domain.ru
62375a5f7fe0b008658657.png
2. And I get this
62375a7418a51478903824.png
3 Go to domain.ru:8080 = Everything is displayed as it should
httpd.conf DocumentRoot "/var/www/domain.ru/www"
listen 8080
virtual host

<VirtualHost *:8080>
Define root_domain домен.ru
Define root_path /var/www/домен

ServerName ${root_domain}
ServerAlias www.${root_domain}
DocumentRoot ${root_path}/www

ErrorLog     ${root_path}/log/apache/error_log
TransferLog  ${root_path}/log/apache/access_log
</VirtualHost>

nginx conf.d
server {
        listen       80;
        server_name  localhost;
        root         /var/www/домен.ru/www;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
index  index.php index.html index.htm;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

location ~ \.php$ {
proxy_pass http://127.0.0.1:8080;
proxy_set_header   Host             $host;
proxy_set_header   X-Forwarded-Proto $scheme;
proxy_set_header   X-Real-IP        $remote_addr;
proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
}
    }


nginx/conf.d/domain.ru.conf
server {
listen       80;
server_name  домен.ru www.домен.ru;
set $root_path /var/www/домен.ru/www;

access_log /var/www/домен.ru/log/nginx/access_log;
error_log /var/www/домен.ru/log/nginx/error_log;
....
    gzip  on;
    gzip_disable "msie6";
    gzip_min_length 1000;
    gzip_vary on;
    gzip_proxied    expired no-cache no-store private auth;
    gzip_types      text/plain text/css application/json application/x-javascrip
....
    root   $root_path;
....
    location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header   Host             $host;
    proxy_set_header   X-Forwarded-Proto $scheme;
    proxy_set_header   X-Real-IP        $remote_addr;
   }
........
        location ~* ^.+\.(jpg|jpeg|gif|png|css|zip|tgz|gz|rar|bz2|doc|docx|xls|x
        expires modified +1w;
        }
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2022-03-20
@karabanov

Look in error.log, it says on what path Nginx tried to find the file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question