As a learner I'm playing with nginx configuration. I hope my wording and question is clear (my question is rather basic at the end).
I have nginx on raspbian server already acting as reverse proxy serving localhost apache website (1stFQDN) I just got it to work serving a second FQDN domain hosted on ubuntu machine in my LAN. I'm trying to serve everything using https.
The raspbian setup is /etc/nginx/sites-available/default:
server {
listen 192.168.1.173:80;
server_name 2ndFQDN;
return 301 https://2ndFQDN$request_uri;
}
server {
listen 192.168.1.173:443 ssl http2;
server_name 2ndFQDN;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl_certificate .... [STANDARD STANZAS]
location / {
proxy_pass http://2ndFQDN:8001;
proxy_set_header Host $http_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 https;
proxy_s....
On the 2ndFQDN machine I have a django based website providing wsgi content using gunicorn on 8001 like this:
$ gunicorn --workers 4 --bind 0.0.0.0:8001 jobs.wsgi:application
I understood the above reverse proxy would work directly (https://2ndFQND to server django website) but it seems I need nginx running on the 2ndFQND with reverse proxy setup like this:-
server {
listen 80;
server_name 2ndFQDN;
root /var/www/html/2ndFQDN;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name 2ndFQDN;
root /var/www/html/2ndFQDN/;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl ......
location / {
proxy_pass http://0.0.0.0:8001;
}
Setup as above it works as I'd expect, i.e I go to https://2ndFQDN and I get django website. but I understood reverse proxy from 1stFQDN server would server content directly i.e with no nginx running on 2ndFQDN.
Do I need nginx also running on the 2ndFQND to reverse proxy the gunicorn service on 8001?
I have nginx on raspbian server already acting as reverse proxy serving localhost apache website (1stFQDN) I just got it to work serving a second FQDN domain hosted on ubuntu machine in my LAN. I'm trying to serve everything using https.
The raspbian setup is /etc/nginx/sites-available/default:
server {
listen 192.168.1.173:80;
server_name 2ndFQDN;
return 301 https://2ndFQDN$request_uri;
}
server {
listen 192.168.1.173:443 ssl http2;
server_name 2ndFQDN;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl_certificate .... [STANDARD STANZAS]
location / {
proxy_pass http://2ndFQDN:8001;
proxy_set_header Host $http_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 https;
proxy_s....
On the 2ndFQDN machine I have a django based website providing wsgi content using gunicorn on 8001 like this:
$ gunicorn --workers 4 --bind 0.0.0.0:8001 jobs.wsgi:application
I understood the above reverse proxy would work directly (https://2ndFQND to server django website) but it seems I need nginx running on the 2ndFQND with reverse proxy setup like this:-
server {
listen 80;
server_name 2ndFQDN;
root /var/www/html/2ndFQDN;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name 2ndFQDN;
root /var/www/html/2ndFQDN/;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
ssl ......
location / {
proxy_pass http://0.0.0.0:8001;
}
Setup as above it works as I'd expect, i.e I go to https://2ndFQDN and I get django website. but I understood reverse proxy from 1stFQDN server would server content directly i.e with no nginx running on 2ndFQDN.
Do I need nginx also running on the 2ndFQND to reverse proxy the gunicorn service on 8001?