1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

update example conf

This commit is contained in:
Tykayn 2021-04-21 17:48:55 +02:00 committed by tykayn
parent 7bba1cc2e1
commit 924f114129

View File

@ -1,9 +1,12 @@
############# start framadate server ############# start framadate server
server { server {
listen 443 ssl http2; listen 443 ssl http2;
listen [::]:443 ssl http2; listen [::]:443 ssl http2;
server_name framadate-api.cipherbliss.com; server_name framadate-api.cipherbliss.com;
root /home/www/tykayn/cipherbliss/framadate-api/public/; root /home/www/tykayn/cipherbliss/framadate-api/public/;
try_files $uri /index.php$is_args$args;
# Use Mozilla's guidelines for SSL/TLS settings # Use Mozilla's guidelines for SSL/TLS settings
# https://mozilla.github.io/server-side-tls/ssl-config-generator/ # https://mozilla.github.io/server-side-tls/ssl-config-generator/
# NOTE: some settings below might be redundant # NOTE: some settings below might be redundant
@ -14,34 +17,7 @@ server {
location / { location / {
try_files $uri /index.php$is_args$args; try_files $uri /index.php$is_args$args;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
#
# Tell client that this pre-flight info is valid for 20 days
#
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';
}
} }
# optionally disable falling back to PHP script for the asset directories; # optionally disable falling back to PHP script for the asset directories;
# nginx will return a 404 error when files are not found instead of passing the # nginx will return a 404 error when files are not found instead of passing the
@ -71,12 +47,14 @@ server {
# for more information). # for more information).
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root; fastcgi_param DOCUMENT_ROOT $document_root;
# Prevents URIs that include the front controller. This will 404: # Prevents URIs that include the front controller. This will 404:
# http://framadate-api.cipherbliss.com/index.php/some-path # http://framadate-api.cipherbliss.com/index.php/some-path
# Remove the internal directive to allow URIs like this # Remove the internal directive to allow URIs like this
internal; internal;
# tests: https://framadate-api.cipherbliss.com/index.php/api/v1/poll/
# https://framadate-api.cipherbliss.com/api/v1/poll/ only this one should work without the internal directive
} }
# return 404 for all other php files not matching the front controller # return 404 for all other php files not matching the front controller