From 095b66391412ad617eda18ceb503704a9f159703 Mon Sep 17 00:00:00 2001 From: sijanec Date: Fri, 9 Oct 2020 16:29:59 +0200 Subject: =?UTF-8?q?added=20nginx=20config=20file=20for=20be=C5=BEiapp=20ht?= =?UTF-8?q?ml=20host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/beziapp.conf | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 server/beziapp.conf (limited to 'server') diff --git a/server/beziapp.conf b/server/beziapp.conf new file mode 100644 index 0000000..1aaa138 --- /dev/null +++ b/server/beziapp.conf @@ -0,0 +1,62 @@ +server { + listen 0.0.0.0:80; + listen [::]:80; + server_name .app.gimb.tk; + return 301 https://app.gimb.tk$request_uri; + port_in_redirect off; + server_name_in_redirect off; +} +server { + listen 0.0.0.0:443 http2 ssl; + listen [::]:443 http2 ssl; + server_name .app.gimb.tk; + ssl_certificate /etc/ssl/sslforfree/gimb.tk.crtca; + ssl_certificate_key /etc/ssl/sslforfree/gimb.tk.key; + root /home/gimb/beziapp.github.io; + location / { + if ($http_origin ~ \.?gimb\.tk$) { + set $cors 'true'; + set $both_conditions "P"; + add_header "x-debug-http-origin-check" "passed"; + } + if ($cors = 'true') { + add_header "Access-Control-Allow-Origin" $http_origin always; + add_header "Access-Control-Allow-Credentials" "true" always; + add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + } + if ($request_method = 'OPTIONS') { + set $both_conditions "${both_conditions}D"; + } + if ($both_conditions = PD) { + add_header "Access-Control-Allow-Origin" $http_origin always; + add_header "Access-Control-Allow-Credentials" "true" always; + add_header "Access-Control-Allow-Methods" "GET, POST, PATCH, PUT, DELETE, OPTIONS" always; + add_header 'Access-Control-Allow-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + add_header 'Access-Control-Expose-Headers' 'Accept,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Requested-With,Authorization' always; + add_header 'Access-Control-Max-Age' -1; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + try_files $uri $uri/ =404; + } + +# pass PHP scripts to FastCGI server +# + location ~ \.php$ { + include snippets/fastcgi-php.conf; +# +# # With php-fpm (or other unix sockets): + fastcgi_pass unix:/run/php/php7.3-fpm.sock; +# # With php-cgi (or other tcp sockets): +# fastcgi_pass 127.0.0.1:9000; + } + location /clear-site-data { + add_header 'clear-site-data' '"*"'; + add_header 'content-type' 'text/plain'; + return 200 "data clear requested, you can go back now."; + } +} + -- cgit v1.2.3