diff options
-rw-r--r-- | nginx_base.sls | 31 | ||||
-rw-r--r-- | theos/init.sls | 7 | ||||
-rw-r--r-- | theos/nginx/git_kyriasis_com.sls | 48 | ||||
-rw-r--r-- | theos/nginx/phabricator_kyriasis_com.sls | 52 | ||||
-rw-r--r-- | theos/nginx/theos_kyriasis_com.sls | 133 | ||||
-rw-r--r-- | theos/nginx/xan_kyriasis_com.sls | 73 | ||||
-rw-r--r-- | top.sls | 6 |
7 files changed, 350 insertions, 0 deletions
diff --git a/nginx_base.sls b/nginx_base.sls new file mode 100644 index 0000000..864a7e2 --- /dev/null +++ b/nginx_base.sls @@ -0,0 +1,31 @@ +nginx: + ng: + source: + opts: {} + service: + enable: True + opts: {} + server: + config: + events: + worker_connections: 1024 + http: + sendfile: 'on' + aio: 'on' + directio: 4m + keepalive_timeout: 65 + gzip: 'on' + gzip_types: text/css + gzip_vary: 'on' + charset: utf-8 + charset_types: text/xml text/plain application/javascript application/rss+xml application/json + server_tokens: 'off' + etag: 'on' + ssi: 'on' + + include: + - /etc/nginx/mime.types + - /etc/nginx/conf.d/*.conf + - /etc/nginx/sites-enabled/* + +# vim: ft=yaml et: diff --git a/theos/init.sls b/theos/init.sls new file mode 100644 index 0000000..387b366 --- /dev/null +++ b/theos/init.sls @@ -0,0 +1,7 @@ +include: + - theos.nginx.theos_kyriasis_com + - theos.nginx.xan_kyriasis_com + - theos.nginx.git_kyriasis_com + - theos.nginx.phabricator_kyriasis_com + +# vim: set ft=yaml et: diff --git a/theos/nginx/git_kyriasis_com.sls b/theos/nginx/git_kyriasis_com.sls new file mode 100644 index 0000000..94631bb --- /dev/null +++ b/theos/nginx/git_kyriasis_com.sls @@ -0,0 +1,48 @@ +nginx: + ng: + servers: + managed: + git.kyriasis.com: + enabled: True + config: + - server: + - server_name: git.kyriasis.com + - listen: 80 + - listen: '[::]:80' + - rewrite: '^ https://$server_name$request_uri? permanent' + + - server: + - server_name: git.kyriasis.com + - listen: 443 ssl http2 + - listen: '[::]:443 ssl http2' + + - ssl: 'on' + - ssl_certificate: /etc/letsencrypt/live/git.kyriasis.com/fullchain.pem + - ssl_certificate_key: /etc/letsencrypt/live/git.kyriasis.com/privkey.pem + - ssl_dhparam: /etc/nginx/dhparam.pem + + - ssl_stapling: 'on' + - ssl_stapling_verify: 'on' + - ssl_trusted_certificate: /etc/letsencrypt/live/git.kyriasis.com/fullchain.pem + + # Enable the Cross-site scripting filter in most recent browsers. + # Normally enabled by default, but enable it anyway if user has disabled it. + - add_header: 'X-XSS-Protection "1; mode=block"' + + # http://www.gnuterrypratchett.com/ + - add_header: 'X-Clacks-Overhead "GNU Terry Pratchett"' + + - root: /usr/share/webapps/cgit + - try_files: $uri @cgit + + - location @cgit: + - include: fastcgi_params + - fastcgi_param: SCRIPT_FILENAME $document_root/cgit.cgi + - fastcgi_param: PATH_INFO $uri + - fastcgi_param: QUERY_STRING $args + - fastcgi_pass: unix:/run/fcgiwrap.sock + + - location /.well-known: + - root: /srv/http/ + +# vim: ft=yaml et: diff --git a/theos/nginx/phabricator_kyriasis_com.sls b/theos/nginx/phabricator_kyriasis_com.sls new file mode 100644 index 0000000..0907731 --- /dev/null +++ b/theos/nginx/phabricator_kyriasis_com.sls @@ -0,0 +1,52 @@ +nginx: + ng: + servers: + managed: + phabricator.kyriasis.com: + enabled: True + config: + - server: + - server_name: phabricator.kyriasis.com + - listen: 80 + - listen: '[::]:80' + - rewrite: '^ https://$server_name$request_uri? permanent' + + - server: + - server_name: phabricator.kyriasis.com + - listen: 443 ssl http2 + - listen: '[::]:443 ssl http2' + + - ssl: 'on' + - ssl_certificate: /etc/letsencrypt/live/phabricator.kyriasis.com/fullchain.pem + - ssl_certificate_key: /etc/letsencrypt/live/phabricator.kyriasis.com/privkey.pem + - ssl_dhparam: /etc/nginx/dhparam.pem + + - ssl_stapling: 'on' + - ssl_stapling_verify: 'on' + - ssl_trusted_certificate: /etc/letsencrypt/live/phabricator.kyriasis.com/fullchain.pem + + # Enable the Cross-site scripting filter in most recent browsers. + # Normally enabled by default, but enable it anyway if user has disabled it. + - add_header: 'X-XSS-Protection "1; mode=block"' + + # http://www.gnuterrypratchett.com/ + - add_header: 'X-Clacks-Overhead "GNU Terry Pratchett"' + + - root: /srv/phabricator/phabricator/webroot + + - location /: + - index: index.php + - rewrite: '^/(.*)$ /index.php?__path__=/$1 last' + + - location /index.php: + - include: fastcgi.conf + - fastcgi_pass: unix:/var/run/php56-fpm/php-fpm.sock + - fastcgi_index: index.php + - fastcgi_param: SCRIPT_FILENAME $document_root$fastcgi_script_name + - fastcgi_param: SCRIPT_NAME $fastcgi_script_name + - fastcgi_param: REMOTE_ADDR $remote_addr + + - location /.well-known: + - root: /srv/http/ + +# vim: ft=yaml et: diff --git a/theos/nginx/theos_kyriasis_com.sls b/theos/nginx/theos_kyriasis_com.sls new file mode 100644 index 0000000..6f9f6fc --- /dev/null +++ b/theos/nginx/theos_kyriasis_com.sls @@ -0,0 +1,133 @@ +nginx: + ng: + servers: + managed: + theos.kyriasis.com: + enabled: True + config: + - server: + - server_name: theos.kyriasis.com + - listen: 80 + - listen: '[::]:80' + - rewrite: '^ https://$server_name$request_uri? permanent' + + - server: + - server_name: theos.kyriasis.com + - listen: 443 ssl http2 + - listen: '[::]:443 ssl http2' + + - ssl: 'on' + - ssl_certificate: /etc/letsencrypt/live/theos.kyriasis.com/fullchain.pem + - ssl_certificate_key: /etc/letsencrypt/live/theos.kyriasis.com/privkey.pem + - ssl_dhparam: /etc/nginx/dhparam.pem + + - ssl_stapling: 'on' + - ssl_stapling_verify: 'on' + - ssl_trusted_certificate: /etc/letsencrypt/live/theos.kyriasis.com/fullchain.pem + + # https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security + - add_header: 'Strict-Transport-Security "max-age=31536000"' + + # Tell browsers not to render the page inside a frame, and avoid clickjacking. + - add_header: X-Frame-Options SAMEORIGIN + + # Tell browsers to not try to auto-detect the Content-Type. + - add_header: X-Content-Type-Options nosniff + + # Enable the Cross-site scripting filter in most recent browsers. + # Normally enabled by default, but enable it anyway if user has disabled it. + - add_header: 'X-XSS-Protection "1; mode=block"' + + # http://www.gnuterrypratchett.com/ + - add_header: 'X-Clacks-Overhead "GNU Terry Pratchett"' + + - location /: + - root: /srv/http + - index: index.html + - autoindex: 'on' + + - location /repo/: + - root: /home/kyrias/packaging + - autoindex: 'on' + + - location /~kyrias: + - alias: /home/kyrias/public_html/ + - index: index.html + - try_files: $uri $uri.html $uri/ =404 + - autoindex: 'on' + - expires: modified +24h + + - location = /~kyrias/journal/10-mercurian-pronouns.html: + - return 301: + - https://web.archive.org/web/https://theos.kyriasis.com/~kyrias/journal/10-mercurian-pronouns.html + + - location ~ \.(js|css|png): + - expires: modified +7d + + - location /~xanadu: + - alias: /home/xanadu/public_html/ + - index: index.html + - try_files: $uri $uri.html $uri/ =404 + - autoindex: 'on' + - expires: modified +24h + + - location /vector: + - alias: /home/kyrias/code/vector/public/ + - try_files: $uri $uri.html $uri/ =404 + + - location /znc: + - proxy_pass: https://127.0.0.1:6697 + - proxy_redirect: '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-Host $server_name + + + - server: + - server_name: h.theos.kyriasis.com + - listen: 80 + - listen: '[::]:80' + + - location /: + - root: /srv/http + - index: index.html + - autoindex: 'on' + + - location /repo/: + - root: /home/kyrias/packaging + - autoindex: 'on' + + - location /~kyrias: + - alias: /home/kyrias/public_html/ + - index: index.html + - try_files: $uri $uri.html $uri/ =404 + - autoindex: 'on' + - expires: modified +24h + + - location = /~kyrias/journal/10-mercurian-pronouns.html: + - return 301: + - https://web.archive.org/web/https://theos.kyriasis.com/~kyrias/journal/10-mercurian-pronouns.html + + - location ~ \.(js|css|png): + - expires: modified +7d + + - location /~xanadu: + - alias: /home/xanadu/public_html/ + - index: index.html + - try_files: $uri $uri.html $uri/ =404 + - autoindex: 'on' + - expires: modified +24h + + - location /vector: + - alias: /home/kyrias/code/vector/public/ + - try_files: $uri $uri.html $uri/ =404 + + - location /znc: + - proxy_pass: https://127.0.0.1:6697 + - proxy_redirect: '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-Host $server_name + + +# vim: ft=yaml et: diff --git a/theos/nginx/xan_kyriasis_com.sls b/theos/nginx/xan_kyriasis_com.sls new file mode 100644 index 0000000..7ba7f9a --- /dev/null +++ b/theos/nginx/xan_kyriasis_com.sls @@ -0,0 +1,73 @@ +nginx: + ng: + servers: + managed: + xan.kyriasis.com: + enabled: True + config: + - server: + - server_name: xan.kyriasis.com + - listen: 80 + - listen: '[::]:80' + - rewrite: + - '^ https://$server_name$request_uri?' + - permanent + + - server: + - server_name: xan.kyriasis.com + - listen: 443 ssl http2 + - listen: '[::]:443 ssl http2' + + - ssl: 'on' + - ssl_certificate: /etc/letsencrypt/live/xan.kyriasis.com/fullchain.pem + - ssl_certificate_key: /etc/letsencrypt/live/xan.kyriasis.com/privkey.pem + - ssl_dhparam: /etc/nginx/dhparam.pem + + - ssl_stapling: 'on' + - ssl_stapling_verify: 'on' + - ssl_trusted_certificate: /etc/letsencrypt/live/xan.kyriasis.com/fullchain.pem + + # Enable the Cross-site scripting filter in most recent browsers. + # Normally enabled by default, but enable it anyway if user has disabled it. + - add_header: 'X-XSS-Protection "1; mode=block"' + + # http://www.gnuterrypratchett.com/ + - add_header: 'X-Clacks-Overhead "GNU Terry Pratchett"' + + - root: /usr/share/webapps/xans-wiki + + - client_max_body_size: 100m + - client_body_timeout: 60 + + - location /: + - index: index.php + - try_files: $uri $uri/ @mediawiki + + - location @mediawiki: + - rewrite: '^/(.*)$ /index.php?title=$1&$args' + + - location ~ \.php5?$: + - include: fastcgi.conf + - fastcgi_pass: unix:/var/run/php-fpm/php-fpm.sock + - fastcgi_index: index.php + - fastcgi_param: SCRIPT_FILENAME $document_root$fastcgi_script_name + - try_files: $uri @mediawiki + + - location ~* \.(js|css|png|jpg|jpeg|gif|ico)$: + - try_files: $uri /index.php + - expires: max + + # Restrictions based on default htaccess file + - location ^~ ^/(cache|includes|maintenance|languages|serialized|tests|images/deleted)/: + - deny: all + + - location ^~ ^/(bin|docs|extensions|includes|maintenance|mw-config|resources|serialized|tests)/: + - internal: '' + + - location ^~ /images/: + - try_files: $uri /index.php + + - location /.well-known: + - root: /srv/http/ + +# vim: ft=yaml et: @@ -0,0 +1,6 @@ +base: + 'theos.kyriasis.com': + - nginx_base + - theos + +# vim: set ft=yaml et: |