# listen on IPv4 and IPv6 on HTTP port listen 80; listen [::]:80; listen 443; listen [::]:443; # set own log format # (defined outside server block in conf.d/log_combined_with_host.conf) access_log /var/log/nginx/access.log combined_with_host; # SSL cert ssl_certificate /etc/letsencrypt/live/NAZWA_DOMENOWA/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/NAZWA_DOMENOWA/privkey.pem; # remove dobles slashes if ( $request_uri ~ "^[^?]*//" ) { rewrite ^/(.*)$ $scheme://$host/$1 permanent; } # remove index.html and index.xhtml if ( $request_uri ~ "/index.x?html$" ) { rewrite ^(.*)/index.x?html$ $scheme://$host$1/ permanent; } # default index files index index.xhtml index.html; # configure mime types include /etc/nginx/mime.types; types { #text/html html htm shtml; #text/css css; #text/xml xml; #application/xhtml+xml xhtml; #application/javascript js; #application/atom+xml atom; #application/rss+xml rss; #application/json json; #image/svg+xml svg svgz; #image/png png; #image/jpeg jpeg jpg; #image/gif gif; #application/pdf pdf; #application/postscript ps eps; #application/x-7z-compressed 7z; #application/zip zip; application/gzip gz; application/x-gtar-compressed tgz; application/x-tar tar; application/x-bzip2 bz2; application/x-xz xz; application/x-geda-schematic sch; application/x-geda-symbol sym; application/x-pcb-layout pcb; application/x-pcb-footprint fp; application/x-pcb-rnd-layout lht; text/x-chdr h; text/x-csrc c; text/x-c++hdr h++ hpp hxx hh; text/x-c++src c++ cpp cxx cc; text/x-sh sh; text/x-python py; text/x-php php; text/x-lua lua; text/x-makefile mk; text/x-cmake cmake; text/x-tex tex ltx sty cls; text/markdown md markdown; text/x-diff diff patch; text/plain conf ini; } location ~ /Makefile$ { default_type text/x-makefile; } location ~ /CMakeLists.txt$ { default_type text/x-cmake; } default_type application/octet-stream; # configure default charset charset utf-8; charset_types text/plain application/xhtml+xml # text/html is always by default text/xml text/markdown text/css text/x-tex text/x-chdr text/x-csrc text/x-c++hdr text/x-c++src text/x-sh text/x-python text/x-php text/x-diff application/atom+xml application/rss+xml application/javascript application/json; # send xhtml as text/html for old browsers # - do internal rewrite to .html if ($http_user_agent !~ "(Mozilla)|(Validator.nu/LV)|(W3C_Validator)|(Gecko)") { rewrite ^(.*).xhtml$ $1.html last; } # - for .html send content from .html or .xhtml but always as text/html location ~ ^(.+)\.html$ { types { "text/html; charset=utf-8" html xhtml; } try_files $1.html $1.xhtml =404; } # WARNING: with this config is NOT POSSIBLE provide simultaneously different # $URI.html and $URI.xhtml files with the same $URI