50 lines
1.2 KiB
Plaintext
Executable File
50 lines
1.2 KiB
Plaintext
Executable File
server {
|
|
listen 443 ssl default_server;
|
|
listen [::]:443 ssl default_server;
|
|
server_name _;
|
|
http2 on;
|
|
set $base /var/www/html;
|
|
root $base/public;
|
|
|
|
# SSL
|
|
ssl_certificate /etc/nginx/ssl/cert.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/key.pem;
|
|
|
|
# security
|
|
include nginxconfig.io/security.conf;
|
|
|
|
# logging
|
|
access_log /var/log/nginx/access.log combined buffer=512k flush=1m;
|
|
error_log /var/log/nginx/error.log warn;
|
|
|
|
# index.php
|
|
index index.php index.html;
|
|
|
|
# index.html fallback
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# index.php fallback
|
|
location ~ ^/api/ {
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
# additional config
|
|
include nginxconfig.io/general.conf;
|
|
|
|
# handle .php
|
|
location ~ \.php$ {
|
|
fastcgi_pass phpfpm:9000;
|
|
include nginxconfig.io/php_fastcgi.conf;
|
|
}
|
|
}
|
|
|
|
# HTTP redirect
|
|
server {
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
server_name _;
|
|
return 301 https://$host:8443$request_uri;
|
|
}
|