This site can’t be reached after Self-Host

Hi,

Followed the " Install Invoice Ninja v5.5 on Ubuntu 22.04"

invoice-ninja-v5-5-on-ubuntu-22-04/13272

My host file resolves the invoice . domain . com (tested with a ping)

The site returns the self signed certificate.

Both invoice . domain . com & invoice . domain . com/setup return :

> # This site can’t be reached
> 
> Check if there is a typo in invoice . domain . com.
> 
> * If spelling is correct, try running Windows Network Diagnostics
> 
> DNS_PROBE_FINISHED_NXDOMAIN

Is there any guru here that could help me or point what I should look into? I think I’m close to make it work but needs to get over that issue.

Thanks!

This is the /etc/nginx/conf.d/invoiceninja.conf

> 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.
>    listen       443 ssl http2 default_server;
>    listen       [::]:443 ssl http2 default_server;
>    server_name  invoice.domain.com;
>    client_max_body_size 20M;
> 
>  # 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) {
>      return 301 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;
> 
>    gzip on;
>    gzip_types application/javascript application/x-javascript text/javascript text/plain application/xml application/json;
>    gzip_proxied    no-cache no-store private expired auth;
>    gzip_min_length 1000;
> 
>    index index.php index.html index.htm;
> 
>  # 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";
>    ssl_session_cache shared:SSL:1m;
>    ssl_session_timeout  10m;
>    ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL';
>    ssl_prefer_server_ciphers on;
>    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
> 
>    charset utf-8;
> 
>  # Load configuration files for the default server block.
>    include /etc/nginx/default.d/*.conf;
> 
>    location / {
>        try_files $uri $uri/ /index.php?$query_string;
>    }
> 
>    if (!-e $request_filename) {
>            rewrite ^(.+)$ /index.php?q= last;
>    }
> 
>    location ~ \.php$ {
>            fastcgi_split_path_info ^(.+\.php)(/.+)$;
>       # Here we pass php requests to the php8.1-fpm listen socket.
>       # PHP errors are often because this value is not correct.
>       # Verify your php8.1-fpm.sock socket file exists at the below directory
>       # and that the php8.1-fpm service is running.
>            fastcgi_pass unix:/run/php/php8.1-fpm.sock;
>            fastcgi_index index.php;
>            include fastcgi_params;
>            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
>            fastcgi_intercept_errors off;
>            fastcgi_buffer_size 16k;
>            fastcgi_buffers 4 16k;
>    }
>    location ~ /\.ht {
>        deny all;
>    }
> 
>    location = /favicon.ico { access_log off; log_not_found off; }
>    location = /robots.txt { access_log off; log_not_found off; }
> 
>    access_log /var/log/nginx/ininja.access.log;
>    error_log /var/log/nginx/ininja.error.log;
> 
>    sendfile off;
>    }
> 
>    server {
>        listen      80;
>        server_name invoice.dopmain.com;
>        add_header Strict-Transport-Security max-age=2592000;
>        rewrite ^ https://$server_name$request_uri? permanent;
>    }

Hi,

@david do you have any suggestions?

I’m not sure what is going on, but is looks like you are injecting the vhost config direct into the main conf file.

Best practice would be to setup a vhost file in

/etc/nginx/sites-available/ninja.conf

you can use the sample nginx conf we have here:

afterwards, create a symlink to sites-enabled

ln -s /etc/nginx/sites-available/ninja.conf /etc/nginx/sites-enabled/

this should be all that is required.

you can check your config is valid with

sudo service nginx configtest

then reload

sudo service nginx reload