Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
- nginx: configuration file /etc/nginx/nginx.conf test is successful
- # configuration file /etc/nginx/nginx.conf:
- #
- # TrueNAS nginx configuration file
- #
- load_module modules/ngx_http_uploadprogress_module.so;
- user www-data www-data;
- worker_processes 1;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- default_type application/octet-stream;
- # We need this because TNC domain exceeds 64
- server_names_hash_bucket_size 128;
- # Types to enable gzip compression on
- gzip_types
- text/plain
- text/css
- text/js
- text/xml
- text/javascript
- application/javascript
- application/x-javascript
- application/json
- application/xml
- application/rss+xml
- image/svg+xml;
- # reserve 1MB under the name 'proxied' to track uploads
- upload_progress proxied 1m;
- sendfile on;
- #tcp_nopush on;
- client_max_body_size 1000m;
- #keepalive_timeout 0;
- keepalive_timeout 65;
- # Disable tokens for security (#23684)
- server_tokens off;
- gzip on;
- access_log /var/log/nginx/access.log combined buffer=32k flush=5s;
- error_log /var/log/nginx/error.log info;
- error_log /var/log/nginx/error.log error;
- map $http_upgrade $connection_upgrade {
- default upgrade;
- '' close;
- }
- map $http_origin $allow_origin {
- ~^https://web.truenasconnect.net$ $http_origin;
- default "";
- }
- server {
- server_name localhost;
- listen 192.168.50.7:444 default_server ssl http2;
- listen [::]:444 default_server ssl http2;
- ssl_certificate "/etc/certificates/cert.crt";
- ssl_certificate_key "/etc/certificates/cert.key";
- ssl_dhparam "/data/dhparam.pem";
- ssl_session_timeout 120m;
- ssl_session_cache shared:ssl:16m;
- ssl_protocols TLSv1.2 TLSv1.3;
- ssl_prefer_server_ciphers on;
- ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA:EDH+aRSA:EECDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!SHA1:!SHA256:!SHA384;
- #resolver ;
- #ssl_trusted_certificate ;
- # Security Headers
- add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
- add_header X-Content-Type-Options "nosniff" always;
- add_header X-XSS-Protection "1; mode=block" always;
- add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()" always;
- add_header Referrer-Policy "strict-origin" always;
- add_header X-Frame-Options "SAMEORIGIN" always;
- location / {
- allow all;
- rewrite ^.* $scheme://$http_host/ui/ redirect;
- }
- location /vm/display/3 {
- proxy_pass http://192.168.50.7:5901/;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection $connection_upgrade;
- }
- location /progress {
- # report uploads tracked in the 'proxied' zone
- report_uploads proxied;
- }
- location /api {
- allow all; # This is handled by `Middleware.ws_can_access` because if we return HTTP 403, browser security
- # won't allow us to understand that connection error was due to client IP not being allowlisted.
- proxy_pass http://127.0.0.1:6000/api;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
- location ~ ^/api/docs/?$ {
- rewrite .* /api/docs/current redirect;
- }
- location /api/docs {
- alias /usr/share/middlewared/docs;
- add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
- add_header Expires 0;
- }
- location /api/docs/current {
- alias /usr/share/middlewared/docs/v25.10.0;
- add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
- add_header Expires 0;
- }
- location @index {
- add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
- add_header Expires 0;
- # Security Headers
- add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
- add_header X-Content-Type-Options "nosniff" always;
- add_header X-XSS-Protection "1; mode=block" always;
- add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()" always;
- add_header Referrer-Policy "strict-origin" always;
- add_header X-Frame-Options "SAMEORIGIN" always;
- root /usr/share/truenas/webui;
- try_files /index.html =404;
- }
- location = /ui/ {
- allow all;
- add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0";
- add_header Expires 0;
- # Security Headers
- add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
- add_header X-Content-Type-Options "nosniff" always;
- add_header X-XSS-Protection "1; mode=block" always;
- add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()" always;
- add_header Referrer-Policy "strict-origin" always;
- add_header X-Frame-Options "SAMEORIGIN" always;
- root /usr/share/truenas/webui;
- try_files /index.html =404;
- }
- location /ui {
- allow all;
- # `allow`/`deny` are not allowed in `if` blocks so we'll have to make that check in the middleware itself.
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Https $https;
- add_header Cache-Control "must-revalidate";
- add_header Etag "TrueNAS-25.10.0";
- # Security Headers
- add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
- add_header X-Content-Type-Options "nosniff" always;
- add_header X-XSS-Protection "1; mode=block" always;
- add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()" always;
- add_header Referrer-Policy "strict-origin" always;
- add_header X-Frame-Options "SAMEORIGIN" always;
- alias /usr/share/truenas/webui;
- try_files $uri $uri/ @index;
- }
- location /websocket {
- allow all; # This is handled by `Middleware.ws_can_access` because if we return HTTP 403, browser security
- # won't allow us to understand that connection error was due to client IP not being allowlisted.
- proxy_pass http://127.0.0.1:6000/websocket;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
- location /websocket/shell {
- allow all; # This is handled by `Middleware.ws_can_access` because if we return HTTP 403, browser security
- # won't allow us to understand that connection error was due to client IP not being allowlisted.
- proxy_pass http://127.0.0.1:6000/_shell;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- proxy_send_timeout 7d;
- proxy_read_timeout 7d;
- }
- location /api/v2.0 {
- # do not add the path to proxy_pass because of automatic url decoding
- # e.g. /api/v2.0/pool/dataset/id/tank%2Ffoo/ would become
- # /api/v2.0/pool/dataset/id/tank/foo/
- proxy_pass http://127.0.0.1:6000;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $remote_addr;
- proxy_set_header X-Server-Port $server_port;
- proxy_set_header X-Scheme $Scheme;
- }
- location /_download {
- proxy_pass http://127.0.0.1:6000;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- proxy_read_timeout 10m;
- }
- location /_upload {
- # Allow uploads of any size. Its middlewared job to handle size.
- client_max_body_size 0;
- proxy_pass http://127.0.0.1:6000;
- # make sure nginx does not buffer the upload and pass directly to middlewared
- proxy_request_buffering off;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- }
- location /_plugins {
- proxy_pass http://127.0.0.1:6000/_plugins;
- proxy_http_version 1.1;
- proxy_set_header X-Real-Remote-Addr $remote_addr;
- proxy_set_header X-Real-Remote-Port $remote_port;
- proxy_set_header X-Https $https;
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-For $remote_addr;
- }
- }
- server {
- listen 192.168.50.7:81;
- listen [::]:81;
- server_name localhost;
- return 307 https://$host:444$request_uri;
- }
- #server {
- #listen 80; # NGINX listens on port 80 for incoming requests
- #server_name home.sommnas.org;
- #error_log /var/log/homeassistant.log debug;
- #location / {
- #proxy_pass http://192.168.50.33:8123/; # Forward requests to the backend on port 8123
- #proxy_set_header Host $host;
- #proxy_read_timeout 30;
- #proxy_buffering off;
- # 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 $scheme;
- #}
- server {
- listen 443 ssl;
- server_name home.sommnas.org;
- error_log /var/log/homeassist.log error;
- error_log /var/log/homeassist.log info;
- error_log /var/log/homeassist.log debug;
- # SSL configuration (point to your certificate and key)
- ssl_certificate "/etc/certificates/cert.crt";
- ssl_certificate_key "/etc/certificates/cert.key";
- location / {
- proxy_pass http://192.168.50.33:8123;
- 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-Proto $scheme;
- # WebSocket support
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
- }
- }
- # configuration file /etc/nginx/mime.types:
- types {
- text/html html htm shtml;
- text/css css;
- text/xml xml;
- image/gif gif;
- image/jpeg jpeg jpg;
- application/javascript js;
- application/atom+xml atom;
- application/rss+xml rss;
- text/mathml mml;
- text/plain txt;
- text/vnd.sun.j2me.app-descriptor jad;
- text/vnd.wap.wml wml;
- text/x-component htc;
- image/avif avif;
- image/png png;
- image/svg+xml svg svgz;
- image/tiff tif tiff;
- image/vnd.wap.wbmp wbmp;
- image/webp webp;
- image/x-icon ico;
- image/x-jng jng;
- image/x-ms-bmp bmp;
- font/woff woff;
- font/woff2 woff2;
- application/java-archive jar war ear;
- application/json json;
- application/mac-binhex40 hqx;
- application/msword doc;
- application/pdf pdf;
- application/postscript ps eps ai;
- application/rtf rtf;
- application/vnd.apple.mpegurl m3u8;
- application/vnd.google-earth.kml+xml kml;
- application/vnd.google-earth.kmz kmz;
- application/vnd.ms-excel xls;
- application/vnd.ms-fontobject eot;
- application/vnd.ms-powerpoint ppt;
- application/vnd.oasis.opendocument.graphics odg;
- application/vnd.oasis.opendocument.presentation odp;
- application/vnd.oasis.opendocument.spreadsheet ods;
- application/vnd.oasis.opendocument.text odt;
- application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
- application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
- application/vnd.wap.wmlc wmlc;
- application/wasm wasm;
- application/x-7z-compressed 7z;
- application/x-cocoa cco;
- application/x-java-archive-diff jardiff;
- application/x-java-jnlp-file jnlp;
- application/x-makeself run;
- application/x-perl pl pm;
- application/x-pilot prc pdb;
- application/x-rar-compressed rar;
- application/x-redhat-package-manager rpm;
- application/x-sea sea;
- application/x-shockwave-flash swf;
- application/x-stuffit sit;
- application/x-tcl tcl tk;
- application/x-x509-ca-cert der pem crt;
- application/x-xpinstall xpi;
- application/xhtml+xml xhtml;
- application/xspf+xml xspf;
- application/zip zip;
- application/octet-stream bin exe dll;
- application/octet-stream deb;
- application/octet-stream dmg;
- application/octet-stream iso img;
- application/octet-stream msi msp msm;
- audio/midi mid midi kar;
- audio/mpeg mp3;
- audio/ogg ogg;
- audio/x-m4a m4a;
- audio/x-realaudio ra;
- video/3gpp 3gpp 3gp;
- video/mp2t ts;
- video/mp4 mp4;
- video/mpeg mpeg mpg;
- video/quicktime mov;
- video/webm webm;
- video/x-flv flv;
- video/x-m4v m4v;
- video/x-mng mng;
- video/x-ms-asf asx asf;
- video/x-ms-wmv wmv;
- video/x-msvideo avi;
- }
Advertisement