server { # NOTE That the 'default_server' option is only necessary if this is your primary domain application. # If you run multiple subdomains from the same host already, remove the 'default_server' option. listen443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; server_name"""invoices.example.ca"""; client_max_body_size20M;
# This if statement will forcefully redirect any connection attempts to explicitly use the domain name. # If not, and your DNS doesn't provide IP address protection, accessing the server with direct IP can # cause glitches with the services provided by the app, that could be security, or usability issues.
if ($host != $server_name) { return301 https://$server_name$request_uri; }
# Here, enter the path to your invoiceninja directory, in the public dir. VERY IMPORTANT # DO NOT point the root directly at your invoiceninja directory, it MUST point at the public folder # This is for security reasons. root /usr/share/nginx/"""invoiceninja"""/public;
# Enter the path to your existing ssl certificate file, and certificate private key file # If you don’t have one yet, you can configure one with openssl in the next step. ssl_certificate"/etc/nginx/cert/ninja.crt"; ssl_certificate_key"/etc/nginx/cert/ninja.key";
if (!-e $request_filename) { rewrite ^(.+)$ /index.php?q= last; }
location~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # Here we pass php requests to the php7.4-fpm listen socket. # PHP errors are often because this value is not correct. # Verify your php7.4-fpm.sock socket file exists at the below directory # and that the php7.4-fpm service is running. fastcgi_pass unix:/run/php/php7.4-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errorsoff; fastcgi_buffer_size16k; fastcgi_buffers416k; }