|
|
# Nginx Proxy Konfiguration on web0.fhnw.ch (Proxy Server) |
|
|
\ No newline at end of file |
|
|
# Nginx Proxy Konfiguration on web0.fhnw.ch (Proxy Server)
|
|
|
|
|
|
Im Verzeichnis `/etc/nginx/conf.d/locations` werden alle Locations (Directories) in separaten Files definiert. Diese werden von der admintools applikation remote erstellt und abgelegt.
|
|
|
```
|
|
|
server {
|
|
|
listen 80;
|
|
|
server_name web0.fhnw.ch;
|
|
|
return 301 https://web0.fhnw.ch$request_uri;
|
|
|
error_log /var/log/nginx/web0.fhnw.ch-error.log debug;
|
|
|
location / {
|
|
|
root /usr/share/nginx/dist;
|
|
|
index index.html index.htm;
|
|
|
}
|
|
|
location /hook/ {
|
|
|
proxy_pass http://localhost:5000;
|
|
|
}
|
|
|
|
|
|
include /etc/nginx/conf.d/locations/*.conf;
|
|
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
location = /50x.html {
|
|
|
root /usr/share/nginx/html;
|
|
|
}
|
|
|
}
|
|
|
server {
|
|
|
listen 443 ssl;
|
|
|
server_name web0.fhnw.ch;
|
|
|
client_max_body_size 10M;
|
|
|
keepalive_timeout 30;
|
|
|
error_log /var/log/nginx/web0.fhnw.ch-error-ssl.log debug;
|
|
|
|
|
|
ssl on;
|
|
|
ssl_certificate /etc/letsencrypt/live/web0.fhnw.ch/fullchain.pem;
|
|
|
ssl_certificate_key /etc/letsencrypt/live/web0.fhnw.ch/privkey.pem;
|
|
|
fastcgi_param HTTPS on;
|
|
|
fastcgi_param HTTP_SCHEME https;
|
|
|
|
|
|
location / {
|
|
|
root /usr/share/nginx/dist;
|
|
|
index index.html index.htm;
|
|
|
}
|
|
|
location /hook/ {
|
|
|
proxy_pass http://localhost:5000;
|
|
|
}
|
|
|
|
|
|
include /etc/nginx/conf.d/locations/*.conf;
|
|
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
location = /50x.html {
|
|
|
root /usr/share/nginx/html;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
```
|
|
|
## Beispiel einer location:
|
|
|
`/etc/nginx/conf.d/locations/test-webdienst.conf`
|
|
|
```
|
|
|
location /test-webdienst {
|
|
|
proxy_redirect off;
|
|
|
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_set_header X-Forwarded-Protocol $scheme;
|
|
|
proxy_pass https://v000155.adm.ds.fhnw.ch/10.0.3.24;
|
|
|
}
|
|
|
``` |