<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>nginx</title> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link rel="stylesheet" href="../style.css" type="text/css" /> <link rel="stylesheet" href="../local.css" type="text/css" /> </head> <body> <div class="page"> <div class="pageheader"> <div class="header"> <span> <span class="parentlinks"> <a href="../index.html">ikiwiki</a>/ <a href="../tips.html">tips</a>/ </span> <span class="title"> nginx </span> </span> </div> </div> <div id="pagebody"> <div id="content" role="main"> <p>There's a lot of scattered info about nginx. This is what I've deduced from reading various blogs, Debian READMEs and the <a href="https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/">nginx wiki</a>.</p> <p>For Debian I suggest installing nginx from <a href="https://www.dotdeb.org/instructions/">dotdeb</a>. They provide the latest stable versions.</p> <p>For cgi install <code>fcgiwrap</code></p> <p>Here is a full sites-enabled/example.com configure for hosting ikiwiki on the root domain, example.com:</p> <p>``` server { listen 443 default_server; listen [::]:443 ssl default_server; root /home/ikiwiki/public_html/wiki;</p> <pre><code>index index.html; server_name example.com www.example.com; ssl_certificate /etc/nginx/ssl/example.com.pem; ssl_certificate_key /etc/nginx/ssl/example.com.key; ssl_session_timeout 5m; ssl_session_cache shared:SSL:50m; ssl_dhparam /etc/nginx/ssl/dhparam.pem; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; resolver 8.8.8.8; ssl_stapling on; ssl_trusted_certificate /etc/nginx/ssl/example.com.pem; add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; client_max_body_size 10m; # ikiwiki site location / { try_files $uri $uri/ =404; } location ~ .cgi { gzip off; fastcgi_pass unix:/var/run/fcgiwrap.socket; include /etc/nginx/fastcgi_params; } </code></pre> <p>}</p> <h1>#</h1> <h1>Forward http to https</h1> <h1>#</h1> <p>server { listen 80 default_server; listen [::]:80 default_server; server_name example.com www.example.com; return 301 https://$host$request_uri; } ```</p> <p>For SSL tips this <a href="https://gist.github.com/plentz/6737338">gist</a> is a good source of information. Use <a href="https://letsencrypt.org/">letsencrypt</a> to get free certificates.</p> </div> </div> <div id="footer" class="pagefooter" role="contentinfo"> <div id="pageinfo"> <div id="backlinks"> Links: <a href="./dot_cgi.html">dot cgi</a> </div> <div class="pagedate"> Last edited <span class="date">Tue Feb 26 23:01:54 2019</span> <!-- Created <span class="date">Tue Feb 26 23:01:54 2019</span> --> </div> </div> <!-- from ikiwiki --> </div> </div> </body> </html>