nginx -T 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: # # FreeNAS 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; # 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; #upload_store /var/tmp/firmware; client_body_temp_path /var/tmp/firmware; access_log off; error_log syslog:server=unix:/dev/log,nohostname; server { server_name localhost; listen 0.0.0.0:81; listen [::]:81; # 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 / { rewrite ^.* $scheme://$http_host/ui/ redirect; } location /progress { # report uploads tracked in the 'proxied' zone report_uploads proxied; } location /api/docs { proxy_pass http://127.0.0.1:6000/api/docs; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Scheme $scheme; proxy_set_header X-Script-Name /api/docs; } location /api/docs/restful/static { alias /usr/local/share/swagger-ui-dist; } location /ui { if ( $request_method ~ ^POST$ ) { proxy_pass http://127.0.0.1:6000; } try_files $uri $uri/ /index.html =404; alias /usr/share/truenas/webui; add_header Cache-Control "must-revalidate"; add_header Etag "TrueNAS-SCALE-22.02.4"; 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 /websocket { 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 Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location /websocket/shell { 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 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 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_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; } location /images { alias /var/db/system/webui/images; } 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 Host $host; proxy_set_header X-Forwarded-For $remote_addr; } } } # 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/png png; image/tiff tif tiff; image/vnd.wap.wbmp wbmp; image/x-icon ico; image/x-jng jng; image/x-ms-bmp bmp; image/svg+xml svg svgz; image/webp webp; application/font-woff woff; 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.ms-excel xls; application/vnd.ms-fontobject eot; application/vnd.ms-powerpoint ppt; application/vnd.wap.wmlc wmlc; application/vnd.google-earth.kml+xml kml; application/vnd.google-earth.kmz kmz; 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; application/vnd.openxmlformats-officedocument.wordprocessingml.document docx; application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx; application/vnd.openxmlformats-officedocument.presentationml.presentation pptx; 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; }