Hallo zusammen,
ich versuche seit geraumer Zeit proxy pass so hinzubekommen das von einer x beliebigen Subdomain das Verzeichnis des Applikationsservers angesteuert wird.
Bsp.
https://subdomain1.domain.com -> http://localhost:8080/subdomain1
https://subdomain2.domain.com -> http://localhost:8080/subdomain2
Momentan bin ich bei Status Quo das ich
https://subdomain1.domain.com -> http://localhost:8080
D. h. ich kann über den Browser subdomain1.domain.com/application1 mit der richtigen Applikation sprechen.
Da ich keine Erfahrungen bzgl. nginx und proxy pass habe bin ich etwas ratlos. Denn ausser einem 502 bzw. Gateway timeout komme ich zu keinem Ergebnis.
Vll. ist Jemand dieses Szenario bekannt oder er hat eine idee. Werde mich mal umsehen wie ich alle debug infos bekommen kann.....
[nginx] proxy pass von subdomain zu jetty
- Payne_of_Death
- Beiträge: 484
- Registriert: 16.05.2004 20:21:30
-
Kontaktdaten:
[nginx] proxy pass von subdomain zu jetty
Das System was mich zu Fall bringt muss erst mal geboren werden.
Re: [nginx] proxy pass von subdomain zu jetty
Poste doch bitte mal deine Konfiguration dann können wir mal nach dem Fehler suchen.
- Payne_of_Death
- Beiträge: 484
- Registriert: 16.05.2004 20:21:30
-
Kontaktdaten:
Re: [nginx] proxy pass von subdomain zu jetty
Kann ich gern machen.
Als letzte Aenderung hatte ich jetzt alle vhost in eine file geworfen, da es in seperaten files zu komischen Effekten bzgl. der Reihenfolge kam.
Als letzte Aenderung hatte ich jetzt alle vhost in eine file geworfen, da es in seperaten files zu komischen Effekten bzgl. der Reihenfolge kam.
Code: Alles auswählen
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html index.php;
server_name www.domain.blog domain.blog;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
}
listen [::]:443 ssl ipv6only=on;
listen 443 ssl default_server;
ssl_certificate /etc/letsencrypt/live/domain.blog/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.blog/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
server_name jenkins.domain.blog;
listen 443;
location / {
#proxy_pass http://localhost:8080/jenkins/$uri$is_args$args;
proxy_pass http://localhost:8080;
#proxy_pass http://localhost:8080/jenkins;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
}
ssl on;
ssl_certificate /etc/letsencrypt/live/domain.blog/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.blog/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
client_max_body_size 4G;
keepalive_timeout 10;
}
server {
if ($host = www.domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = froxlor.domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = phpma.domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = webalizer.domain.blog) {
return 301 https://$host$request_uri;
}
listen 80 ;
listen [::]:80 ;
server_name www.domain.blog domain.blog;
return 404;
}
Das System was mich zu Fall bringt muss erst mal geboren werden.
Re: [nginx] proxy pass von subdomain zu jetty
Also der letzte Code Block ist so eine Sache:
if ($host = froxlor.domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = phpma.domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = webalizer.domain.blog) {
return 301 https://$host$request_uri;
}
Das kann eigentlich gar nicht funktionieren da diese Hostnamen für den Server gar nicht definiert sind.
Du müsstest für jede Domain schon einen vhost konfigurieren. Gerade wenn du mit ssl arbeiten willst wirst du da nicht herumkommen. Eventuell mit Wildcard Zertifikaten könnte man das umgehen.
Das Proxy pass sollte schon funktionieren.
location / {
proxy_pass http://backend/path;
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_max_temp_file_size 0;
proxy_pass_header Set-Cookie;
}
Ich arbeite meist mit Upstream Definition aber das macht keinen unterschied.
weiters listen 443; --> da gehört ssl dazu
Was steht denn überhaupt in dem LE Config File drinnen?
lg
Gregor
if ($host = froxlor.domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = phpma.domain.blog) {
return 301 https://$host$request_uri;
}
if ($host = webalizer.domain.blog) {
return 301 https://$host$request_uri;
}
Das kann eigentlich gar nicht funktionieren da diese Hostnamen für den Server gar nicht definiert sind.
Du müsstest für jede Domain schon einen vhost konfigurieren. Gerade wenn du mit ssl arbeiten willst wirst du da nicht herumkommen. Eventuell mit Wildcard Zertifikaten könnte man das umgehen.
Das Proxy pass sollte schon funktionieren.
location / {
proxy_pass http://backend/path;
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_max_temp_file_size 0;
proxy_pass_header Set-Cookie;
}
Ich arbeite meist mit Upstream Definition aber das macht keinen unterschied.
weiters listen 443; --> da gehört ssl dazu
Was steht denn überhaupt in dem LE Config File drinnen?
lg
Gregor
- Payne_of_Death
- Beiträge: 484
- Registriert: 16.05.2004 20:21:30
-
Kontaktdaten:
Re: [nginx] proxy pass von subdomain zu jetty
Kam leider erst jetzt dazu zu antworten.
Ich habe nur das Minimalset gepostet die übrigen Hosts nutzen kein proxy pass aber der Vervollständigungshalber
Die SSL Geschichte wurde mittels certbot gemacht.
In der options-ssl-nginx.conf steht nur
Ich habe nur das Minimalset gepostet die übrigen Hosts nutzen kein proxy pass aber der Vervollständigungshalber
Code: Alles auswählen
server {
root /var/www/froxlor;
index index.php;
server_name froxlor.domain.blog;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
}
#listen [::]:443 ssl ipv6only=on;
#listen 443 ssl;
#ssl_certificate /etc/letsencrypt/live/domain.blog/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/domain.blog/privkey.pem;
#include /etc/letsencrypt/options-ssl-nginx.conf;
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
root /var/www/phpma;
index index.html index.htm index.nginx-debian.html index.php;
server_name phpma.domain.blog;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
}
#listen [::]:443 ssl ipv6only=on;
#listen 443 ssl;
#ssl_certificate /etc/letsencrypt/live/domain.blog/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/domain.blog/privkey.pem;
#include /etc/letsencrypt/options-ssl-nginx.conf;
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
server {
root /var/www/webalizer;
index index.html index.htm index.nginx-debian.html index.php;
server_name webalizer.domain.blog;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
}
#listen [::]:443 ssl ipv6only=on;
#listen 443 ssl;
#ssl_certificate /etc/letsencrypt/live/domain.blog/fullchain.pem;
#ssl_certificate_key /etc/letsencrypt/live/domain.blog/privkey.pem;
#include /etc/letsencrypt/options-ssl-nginx.conf;
#ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}
In der options-ssl-nginx.conf steht nur
Code: Alles auswählen
ssl_session_cache shared:le_nginx_SSL:1m;
ssl_session_timeout 1440m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "ECDHE-ECDSA......
Das System was mich zu Fall bringt muss erst mal geboren werden.