53 lines
2.4 KiB
Plaintext
53 lines
2.4 KiB
Plaintext
server {
|
|
listen 80 ;
|
|
listen 443 ssl ;
|
|
server_name ai-api.websoft.top;
|
|
index index.php index.html index.htm default.php default.htm default.html;
|
|
access_log /www/sites/ai-api.websoft.top/log/access.log main;
|
|
error_log /www/sites/ai-api.websoft.top/log/error.log;
|
|
location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md) {
|
|
return 404;
|
|
}
|
|
location ^~ /.well-known/acme-challenge {
|
|
allow all;
|
|
root /usr/share/nginx/html;
|
|
}
|
|
if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
|
|
return 403;
|
|
}
|
|
|
|
http2 on;
|
|
if ($scheme = http) {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
ssl_certificate /www/sites/ai-api.websoft.top/ssl/fullchain.pem;
|
|
ssl_certificate_key /www/sites/ai-api.websoft.top/ssl/privkey.pem;
|
|
ssl_protocols TLSv1.3 TLSv1.2;
|
|
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DSS:!DES:!RC4:!3DES:!MD5:!PSK:!KRB5:!SRP:!CAMELLIA:!SEED;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 10m;
|
|
error_page 497 https://$host$request_uri;
|
|
proxy_set_header X-Forwarded-Proto https;
|
|
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
|
|
# CORS: allow any *.websoft.top (and websoft.top) Origin; echo Origin for credentialed requests.
|
|
# Keep wildcard for non-websoft origins without credentials.
|
|
set $cors_origin "*";
|
|
set $cors_credentials "false";
|
|
if ($http_origin ~* '^https?://([a-z0-9-]+\.)*websoft\.top(?::[0-9]+)?$') {
|
|
set $cors_origin $http_origin;
|
|
set $cors_credentials "true";
|
|
}
|
|
add_header Access-Control-Allow-Origin $cors_origin always;
|
|
add_header Access-Control-Allow-Credentials $cors_credentials always;
|
|
add_header Access-Control-Allow-Methods "GET,POST,PUT,PATCH,DELETE,OPTIONS" always;
|
|
add_header Access-Control-Allow-Headers "$http_access_control_request_headers" always;
|
|
add_header Vary "Origin" always;
|
|
if ($request_method = OPTIONS) {
|
|
add_header Content-Length 0;
|
|
add_header Content-Type text/plain;
|
|
return 204;
|
|
}
|
|
include /www/sites/ai-api.websoft.top/proxy/*.conf;
|
|
}
|