Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
nginx [2025/06/13 14:40] jango [HTTP] |
nginx [2025/06/22 00:58] (aktuell) jango [HTTP] |
||
---|---|---|---|
Zeile 30: | Zeile 30: | ||
http { | http { | ||
server { | server { | ||
- | listen | + | listen |
location / { | location / { | ||
root html; | root html; | ||
Zeile 57: | Zeile 57: | ||
</ | </ | ||
+ | =====Weiterleitung===== | ||
+ | |||
+ | < | ||
+ | server { | ||
+ | listen 80; | ||
+ | server_name example.com www.example.com; | ||
+ | |||
+ | # Leite alle Anfragen auf HTTPS um | ||
+ | return 301 https:// | ||
+ | } | ||
+ | server { | ||
+ | listen 443 ssl; | ||
+ | server_name example.com www.example.com; | ||
+ | root / | ||
+ | index index.html; | ||
+ | | ||
+ | ssl_certificate / | ||
+ | ssl_certificate_key / | ||
+ | |||
+ | # Weitere SSL-Einstellungen (optional aber empfohlen) | ||
+ | ssl_protocols TLSv1.2 TLSv1.3; | ||
+ | ssl_ciphers HIGH: | ||
+ | |||
+ | location / { | ||
+ | try_files $uri $uri/ =404; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | =====PHP===== | ||
+ | |||
+ | [[coding: | ||
+ | < | ||
+ | server { | ||
+ | location ~ \.php$ { | ||
+ | include snippets/ | ||
+ | fastcgi_pass unix:/ | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Prevent download of .htaccess files | ||
+ | |||
+ | < | ||
+ | server { | ||
+ | location ~ /\.ht { | ||
+ | deny all; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
=====Proxy===== | =====Proxy===== | ||