Как настроить Nginx для нескольких серверов, работающих на одном хосте, но с другим портом? - PullRequest
0 голосов
/ 31 марта 2020

Я использую серверы Jenkins, SonarQube и Prometheus на одном хост-компьютере, но настроен на разных портах на компьютере CentOS. Я хочу настроить их за Nginx сервером. Я установил nginx и настроил файл nginx .conf. Но он работает правильно только для "/" URL. Для других это не работает. Конфигурация:

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    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;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    server {
        listen 80;
        access_log /var/log/nginx/reverse-access.log;
        error_log /var/log/nginx/reverse-error.log;
        location / {
                    proxy_pass http://localhost:8080/;
        }
        location /sonar {

                proxy_pass http://localhost:9000/;
        }
        location /prom {

                proxy_pass http://localhost:9090/;
       }
    }
}

Что еще нужно сделать? Я не могу получить точный результат. Кто-нибудь может мне помочь в этом?

...