63 lines
2.2 KiB
Markdown
63 lines
2.2 KiB
Markdown
There's a lot of scattered info about nginx. This is what I've deduced from reading various blogs, Debian READMEs and the [nginx wiki](https://www.nginx.com/resources/wiki/start/topics/examples/fcgiwrap/).
|
|
|
|
For Debian I suggest installing nginx from [dotdeb](https://www.dotdeb.org/instructions/). They provide the latest stable versions.
|
|
|
|
For cgi install ```fcgiwrap```
|
|
|
|
Here is a full sites-enabled/example.com configure for hosting ikiwiki on the root domain, example.com:
|
|
|
|
```
|
|
server {
|
|
listen 443 default_server;
|
|
listen [::]:443 ssl default_server;
|
|
root /home/ikiwiki/public_html/wiki;
|
|
|
|
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;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
##
|
|
#Forward http to https
|
|
##
|
|
|
|
server {
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
server_name example.com www.example.com;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
```
|
|
|
|
For SSL tips this [gist](https://gist.github.com/plentz/6737338) is a good source of information. Use [letsencrypt](https://letsencrypt.org/) to get free certificates.
|