mirror of
https://github.com/cloudpanel-io/vhost-templates.git
synced 2026-05-18 16:33:30 +08:00
94 lines
2.7 KiB
Plaintext
Executable File
94 lines
2.7 KiB
Plaintext
Executable File
#{"rootDirectory":"","phpVersion":"7.4"}
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
listen 443 ssl http2;
|
|
listen [::]:443 ssl http2;
|
|
{{ssl_certificate_key}}
|
|
{{ssl_certificate}}
|
|
{{server_name}}
|
|
{{root}}
|
|
|
|
{{nginx_access_log}}
|
|
{{nginx_error_log}}
|
|
|
|
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
|
|
|
|
if ($scheme != "https") {
|
|
rewrite ^ https://$host$uri permanent;
|
|
}
|
|
|
|
{{settings}}
|
|
|
|
location = /.well-known/carddav {
|
|
return 301 $scheme://$host/remote.php/dav;
|
|
}
|
|
|
|
location = /.well-known/caldav {
|
|
return 301 $scheme://$host/remote.php/dav;
|
|
}
|
|
|
|
error_page 403 /core/templates/403.php;
|
|
error_page 404 /core/templates/404.php;
|
|
|
|
location / {
|
|
rewrite ^ /index.php$uri;
|
|
}
|
|
|
|
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
|
|
return 404;
|
|
}
|
|
|
|
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
|
|
return 404;
|
|
}
|
|
|
|
try_files $uri $uri/ /index.php?$args;
|
|
index index.php index.html;
|
|
|
|
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) {
|
|
include fastcgi_params;
|
|
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
|
|
set $path_info $fastcgi_path_info;
|
|
try_files $fastcgi_script_name =404;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
fastcgi_param PATH_INFO $path_info;
|
|
fastcgi_param front_controller_active true;
|
|
fastcgi_read_timeout 3600;
|
|
fastcgi_send_timeout 3600;
|
|
fastcgi_param HTTPS $fastcgi_https;
|
|
fastcgi_pass 127.0.0.1:{{php_fpm_port}};
|
|
fastcgi_param PHP_VALUE "{{php_settings}}";
|
|
}
|
|
|
|
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
|
|
try_files $uri $uri/ =404;
|
|
index index.php;
|
|
}
|
|
|
|
location ~* \.(?:css|js)$ {
|
|
try_files $uri /index.php$uri$is_args$args;
|
|
add_header Cache-Control "public, max-age=7200";
|
|
# Add headers to serve security related headers (It is intended to have those duplicated to the ones above)
|
|
# Before enabling Strict-Transport-Security headers please read into this topic first.
|
|
#add_header Strict-Transport-Security "max-age=15552000; includeSubDomains";
|
|
add_header X-Content-Type-Options nosniff;
|
|
add_header X-Frame-Options "SAMEORIGIN";
|
|
add_header X-XSS-Protection "1; mode=block";
|
|
add_header X-Robots-Tag none;
|
|
add_header X-Download-Options noopen;
|
|
add_header X-Permitted-Cross-Domain-Policies none;
|
|
# Optional: Don't log access to assets
|
|
access_log off;
|
|
}
|
|
|
|
location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ {
|
|
try_files $uri /index.php$uri$is_args$args;
|
|
# Optional: Don't log access to other assets
|
|
access_log off;
|
|
}
|
|
|
|
if (-f $request_filename) {
|
|
break;
|
|
}
|
|
} |