add & run prettier-plugin-nginx

This commit is contained in:
Aminda Suomalainen 2023-05-18 11:33:33 +03:00
parent e0dc070cd1
commit 687a6433bb
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q
8 changed files with 132 additions and 152 deletions

View File

@ -18,6 +18,7 @@ repos:
- id: destroyed-symlinks - id: destroyed-symlinks
- id: detect-private-key - id: detect-private-key
- id: end-of-file-fixer - id: end-of-file-fixer
exclude: .*\.nginx$
- id: fix-byte-order-marker - id: fix-byte-order-marker
- id: trailing-whitespace - id: trailing-whitespace
# Let's not touch LICENSE files or reuse.software directory # Let's not touch LICENSE files or reuse.software directory
@ -69,7 +70,8 @@ repos:
hooks: hooks:
- id: prettier - id: prettier
exclude_types: [python, pyi, jupyter] exclude_types: [python, pyi, jupyter]
additional_dependencies: ["prettier@2.8.8"] additional_dependencies:
["prettier@2.8.8", "prettier-plugin-nginx@1.0.3"]
# Black, opinionated Python code formatter # Black, opinionated Python code formatter
# - repo: https://github.com/psf/black # - repo: https://github.com/psf/black
@ -86,6 +88,7 @@ repos:
alias: ec alias: ec
# I don't actually care about line lengths as more than a guideline # I don't actually care about line lengths as more than a guideline
args: [-disable-max-line-length] args: [-disable-max-line-length]
exclude: .*\.nginx$
# # Python linter # # Python linter
# - repo: local # - repo: local

View File

@ -1,15 +1,14 @@
server { server {
listen 80; listen 80;
listen 443; listen 443;
listen 14402; listen 14402;
listen [::]:80; listen [::]:80;
listen [::]:443; listen [::]:443;
listen [::]:14402; listen [::]:14402;
ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem; ssl_certificate_key /etc/nginx/ssl/key.pem;
server_name bitbot.relpda.mikaela.info; server_name bitbot.relpda.mikaela.info;
access_log /var/log/nginx/bitbot.access.log main;
access_log /var/log/nginx/bitbot.access.log main;
location / { location / {
proxy_pass http://[::1]:9050; proxy_pass http://[::1]:9050;

View File

@ -1,20 +1,20 @@
# Cloudflare # Cloudflare
set_real_ip_from 199.27.128.0/21; set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20; set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22; set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22; set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22; set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18; set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18; set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20; set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20; set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22; set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17; set_real_ip_from 198.41.128.0/17;
set_real_ip_from 162.158.0.0/15; set_real_ip_from 162.158.0.0/15;
set_real_ip_from 104.16.0.0/12; set_real_ip_from 104.16.0.0/12;
set_real_ip_from 2400:cb00::/32; set_real_ip_from 2400:cb00::/32;
set_real_ip_from 2606:4700::/32; set_real_ip_from 2606:4700::/32;
set_real_ip_from 2803:f800::/32; set_real_ip_from 2803:f800::/32;
set_real_ip_from 2405:b500::/32; set_real_ip_from 2405:b500::/32;
set_real_ip_from 2405:8100::/32; set_real_ip_from 2405:8100::/32;
real_ip_header CF-Connecting-IP; real_ip_header CF-Connecting-IP;

View File

@ -1,42 +1,37 @@
server { server {
listen 80; listen 80;
listen 443 ssl; listen 443 ssl;
listen 14402 ssl; listen 14402 ssl;
listen [::]:80 ipv6only=on; listen [::]:80 ipv6only=on;
listen [::]:443 ssl ipv6only=on; listen [::]:443 ssl ipv6only=on;
listen [::]:14402 ssl ipv6only=on; listen [::]:14402 ssl ipv6only=on;
ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem; ssl_certificate_key /etc/nginx/ssl/key.pem;
server_name relpda.mikaela.info; server_name relpda.mikaela.info;
#charset koi8-r; #charset koi8-r;
#access_log /var/log/nginx/host.access.log main; #access_log /var/log/nginx/host.access.log main;
#location /api/ {
#location /api/ { # proxy_pass http://[::1]:9050;
# proxy_pass http://[::1]:9050; # }
# }
location / { location / {
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html index.htm; index index.html index.htm;
} }
#error_page 404 /404.html; #error_page 404 /404.html;
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html
# #
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
# #
#location ~ \.php$ { #location ~ \.php$ {
# proxy_pass http://127.0.0.1; # proxy_pass http://127.0.0.1;
#} #}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# #
#location ~ \.php$ { #location ~ \.php$ {
@ -46,7 +41,6 @@ server {
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params; # include fastcgi_params;
#} #}
# deny access to .htaccess files, if Apache's document root # deny access to .htaccess files, if Apache's document root
# concurs with nginx's one # concurs with nginx's one
# #

View File

@ -1,2 +1,2 @@
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

View File

@ -1,51 +1,47 @@
server { server {
listen 80 default_server; listen 80 default_server;
listen [::]:80 default_server ipv6only=on; listen [::]:80 default_server ipv6only=on;
listen 443 default_server ssl http2; listen 443 default_server ssl http2;
listen [::]:443 default_server ssl http2 ipv6only=on; listen [::]:443 default_server ssl http2 ipv6only=on;
root /var/www/default/;
root /var/www/default/; index index.php index.html index.htm;
index index.php index.html index.htm; ### Generating SSL certificate:
## mkdir -p /etc/nginx/ssl && cd /etc/nginx/ssl
### Generating SSL certificate: ## openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout nginx.key -out nginx.crt
## mkdir -p /etc/nginx/ssl && cd /etc/nginx/ssl ### this takes forever and is used on line 23.
## openssl req -x509 -nodes -days 3650 -newkey rsa:4096 -keyout nginx.key -out nginx.crt ## openssl dhparam -out dhparam.pem 4096
### this takes forever and is used on line 23. ssl_certificate /etc/nginx/ssl/nginx.crt;
## openssl dhparam -out dhparam.pem 4096 ssl_certificate_key /etc/nginx/ssl/nginx.key;
ssl_certificate /etc/nginx/ssl/nginx.crt; # ----- begin of Mozilla Server Side TLS recommendations -----
ssl_certificate_key /etc/nginx/ssl/nginx.key; # **2014-11-07** https://wiki.mozilla.org/Security/Server_Side_TLS
# ----- begin of Mozilla Server Side TLS recommendations ----- ssl_session_timeout 5m;
# **2014-11-07** https://wiki.mozilla.org/Security/Server_Side_TLS ssl_session_cache shared:SSL:50m;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
# Diffie-Hellman parameter for DHE ciphersuites, recommended 4096 bits # Diffie-Hellman parameter for DHE ciphersuites, recommended 4096 bits
# See generation on line 14 # See generation on line 14
ssl_dhparam /etc/nginx/ssl/dhparam.pem; ssl_dhparam /etc/nginx/ssl/dhparam.pem;
# Intermediate configuration. tweak to your needs. # Intermediate configuration. tweak to your needs.
# comment just for me, don't uncomment. # comment just for me, don't uncomment.
#ssl_ciphers ''; #ssl_ciphers '';
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA'; ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on; ssl_prefer_server_ciphers on;
# Enable this if your want HSTS (recommended) # Enable this if your want HSTS (recommended)
add_header Strict-Transport-Security "max-age=15552000; includeSubdomains; preload"; add_header Strict-Transport-Security
add_header X-Frame-Options SAMEORIGIN; "max-age=15552000; includeSubdomains; preload";
add_header Content-Security-Policy upgrade-insecure-requests; add_header X-Frame-Options SAMEORIGIN;
add_header X-Xss-Protection "1; mode=block" always; add_header Content-Security-Policy
add_header X-Content-Type-Options "nosniff" always; upgrade-insecure-requests;
add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
# OCSP Stapling --- # OCSP Stapling ---
# fetch OCSP records from URL in ssl_certificate and cache them # fetch OCSP records from URL in ssl_certificate and cache them
ssl_stapling on; ssl_stapling on;
ssl_stapling_verify on; ssl_stapling_verify on;
## verify chain of trust of OCSP response using Root CA and Intermediate certs ## verify chain of trust of OCSP response using Root CA and Intermediate certs
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates; #ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates;
#resolver ::1; #resolver ::1;
# ----- end of Mozilla Server Side TLS recommendations ----- # ----- end of Mozilla Server Side TLS recommendations -----
location / { location / {
# First attempt to serve request as file, then # First attempt to serve request as file, then
# as directory, then fall back to displaying a 404. # as directory, then fall back to displaying a 404.
@ -55,34 +51,31 @@ server {
# Userdir # Userdir
location ~ ^/~(.+?)(/.*)?$ { location ~ ^/~(.+?)(/.*)?$ {
alias /home/$1/public_html$2; alias /home/$1/public_html$2;
index index.html index.htm; index index.html index.htm;
autoindex on; autoindex on;
} }
#error_page 404 /404.html; #error_page 404 /404.html;
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html
# #
#error_page 500 502 503 504 /50x.html; #error_page 500 502 503 504 /50x.html;
#location = /50x.html { #location = /50x.html {
# root /usr/share/nginx/html; # root /usr/share/nginx/html;
#} #}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# #
location ~ \.php$ { location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# #
# # With php5-cgi alone: # # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000; # fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm: # # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php; fastcgi_index index.php;
#include fastcgi_params; #include fastcgi_params;
include fastcgi.conf; include fastcgi.conf;
} }
# deny access to .htaccess files, if Apache's document root # deny access to .htaccess files, if Apache's document root

View File

@ -1,22 +1,20 @@
server { server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
listen 443; listen 443;
listen [::]:443; listen [::]:443;
# Enable this if your want HSTS (recommended) # Enable this if your want HSTS (recommended)
add_header Strict-Transport-Security "max-age=15552000; includeSubdomains; preload"; add_header Strict-Transport-Security
add_header X-Frame-Options SAMEORIGIN; "max-age=15552000; includeSubdomains; preload";
add_header Content-Security-Policy upgrade-insecure-requests; add_header X-Frame-Options SAMEORIGIN;
add_header X-Xss-Protection "1; mode=block" always; add_header Content-Security-Policy upgrade-insecure-requests;
add_header X-Content-Type-Options "nosniff" always; add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
server_name something.example.org; server_name something.example.org;
# NOTE: For X-Real-IP & X-Forwarded-For see ../conf.d/rproxy.conf # NOTE: For X-Real-IP & X-Forwarded-For see ../conf.d/rproxy.conf
# Behind CloudFlare see ../conf.d/cloudflare.conf # Behind CloudFlare see ../conf.d/cloudflare.conf
location / {
location / { proxy_pass http://localhost:8080;
proxy_pass http://localhost:8080;
} }
} }

View File

@ -1,21 +1,18 @@
server { server {
# default_server from default vhost must exist somewhere! # default_server from default vhost must exist somewhere!
listen 80; listen 80;
listen [::]:80; listen [::]:80;
listen 443; listen 443;
listen [::]:443; listen [::]:443;
# Enable this if your want HSTS (recommended) # Enable this if your want HSTS (recommended)
add_header Strict-Transport-Security "max-age=15552000; includeSubdomains; preload"; add_header Strict-Transport-Security
add_header X-Frame-Options SAMEORIGIN; "max-age=15552000; includeSubdomains; preload";
add_header Content-Security-Policy upgrade-insecure-requests; add_header X-Frame-Options SAMEORIGIN;
add_header X-Xss-Protection "1; mode=block" always; add_header Content-Security-Policy upgrade-insecure-requests;
add_header X-Content-Type-Options "nosniff" always; add_header X-Xss-Protection "1; mode=block" always;
add_header X-Content-Type-Options "nosniff" always;
root /var/www/vhostdir; root /var/www/vhostdir;
index index.php index.html index.htm; index index.php index.html index.htm;
# vhost address # vhost address
server_name vhost.example.org; server_name vhost.example.org;
@ -32,30 +29,26 @@ server {
# index index.html index.htm; # index index.html index.htm;
# autoindex on; # autoindex on;
#} #}
#error_page 404 /404.html; #error_page 404 /404.html;
# redirect server error pages to the static page /50x.html # redirect server error pages to the static page /50x.html
# #
#error_page 500 502 503 504 /50x.html; #error_page 500 502 503 504 /50x.html;
#location = /50x.html { #location = /50x.html {
# root /usr/share/nginx/html; # root /usr/share/nginx/html;
#} #}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
# #
location ~ \.php$ { location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# #
# # With php5-cgi alone: # # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000; # fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm: # # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php; fastcgi_index index.php;
#include fastcgi_params; #include fastcgi_params;
include fastcgi.conf; include fastcgi.conf;
} }
# deny access to .htaccess files, if Apache's document root # deny access to .htaccess files, if Apache's document root