The page you requested was not found. Please check that you typed the URL correctly

Hello @gutiersa, @sjpadgett and @brady.miller. I am unable to bring up the Portal Dashboard from the Miscellaneous tab. Initially it was working on V6 but once i upgraded, i am unable to bring up the Portal Dashboard.
The error in the picture below shows up anytime i try to bring up the portal dashboard.

OpenEMR Version
7.0.0(1)

Browser:
Safari

Operating System
Running OpenEMR on Ubuntu with NGINX and Proxy Manager. My OpenEMR instance is on a subdomain. i don’t know if it makes any difference.

Logs
NGINX error log is clean

Please see my NGINX configuration file below


server {
        listen xxxx;
        listen [::]:xxxx;

        root /var/www/html/openemr;
        index index.html index.php index.htm;

        server_name xxxx.com;

        location / {
                #try_files $uri $uri/ =404;
                try_files $uri $uri/ /index.php$is_args$args;
        }

        # pass PHP scripts to FastCGI server
        #
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                # 
                # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        }

#If condition included to handle Patient Portal
        if (!-e $request_filename) {
            # Needed for zend to work
            # rewrite ^(.*/zend_modules/public)(.*) $1/index.php?$is_args$args last;

            # Needed for patient portal to work
            rewrite ^(.*/portal/patient)(.*) $1/index.php?_REWRITE_COMMAND=$1$2 last;

            # Needed for REST API/FHIR to work
            rewrite ^(.*/apis/)(.*) $1/dispatch.php?_REWRITE_COMMAND=$2 last;

            # Needed for OAuth2 to work
            rewrite ^(.*/oauth2/)(.*) $1/authorize.php?_REWRITE_COMMAND=$2 last;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }



    listen [::]:11443 ssl ipv6only=on; # managed by Certbot
    listen 11443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/xxxx/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/xxxx/privkey.pem; # managed by Certbot

include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    if ($host = xxxx.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


        listen xxxx;

        server_name xxxx.com;
    return 404; # managed by Certbot


}

Thanks in advance

1 Like

Here is my process!

This is what I get with my server:

It works for me. Next I will look at your nginx configuration file.
Oh, I am assuming it worked in the past on Safari.

Yes. It worked previously on Safari. Can you share your configuration file?

1 Like

I don’t see an “error_log” definition here, is it upstream for this server conf file?

Sure, I will share my configuration file. Hang on…

1 Like

Here is my configuration file. I hope it is not too confusing, I write a lot of messages to myself:

upstream domain.com { server unix:/var/run/php-fpm_domain.com.sock; }
# Redirect HTTP to HTTPS version for Specified domain in Nginx
#server { listen 80; server_name domain.com www.domain.com; return 301 
https://domain.com$request_uri; }

# HTTP server an openemr site
 server {
 	if ($host = www.domain.com) { return 301 https://$host$request_uri; } 
    if ($host = domain.com) { return 301 https://$host$request_uri; } 
    listen  *:80;
    #listen 		[::];
    server_name  domain.com www.domain.com;
    return 404; 
}
# HTTPS server
# an openemr site, remove www
server { listen 443 ssl http2; server_name www.domain.com; return 301 
https://domain.com$request_uri;
    ssl_certificate /path/to/certs/www.domain.com/fullchain.pem; 
    ssl_certificate_key /path/to/certs/www.domain.com/privkey.pem; 
}

server {
    listen *:443 ssl http2; 
    server_name  domain.com;
    root   /usr/local/www/domain.com;
    
	#modsecurity_transaction_id "'$server_name'443-'$request_id'";
    ssl_certificate /path/to/certs/domain.com-0001/fullchain.pem; 
    ssl_certificate_key /path/to/certs/domain.com-0001/privkey.pem; 
    include /path/to/ssl-options/options-ssl-nginx.conf; 
	ssl_dhparam /path/to/ssl-options/ssl-dhparams.pem; 
    # verify chain of trust of OCSP response using Root CA and Intermediate certs
    #ssl_trusted_certificate /path/to/certs/domain.com/chain.pem;
  #ssl_prefer_server_ciphers  on;

    access_log  /path/to/logs/domain.com.access.log combined if=$loggable buffer=512k flush=1m;
	error_log  /path/to/logs/domain.com.error.log;
    
    # set client body size to 6M not allowing uploads greater than 6M#
	client_max_body_size 20M;
	# enable compression to speed up the system:
	include enable-compression.conf;
    expires $expires;

    # site specific configuration file
    include openemr.conf;
    
    # Needed for zend modules and patient portal to work
	# https://www.nginx.com/blog/converting-apache-to-nginx-rewrite-rules/
    # if is evil only in the location block
	# http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite_log
	if (!-e $request_filename) {
		rewrite ^(.*/zend_modules/public)(.*) 	$1/index.php?$2 last;
    	rewrite ^(.*/portal/patient)(.*) 		$1/index.php?_REWRITE_COMMAND=$1$2 last;
		# Needed for REST API/FHIR to work
        rewrite ^(.*/apis/)(.*) 				$1/dispatch.php?_REWRITE_COMMAND=$2 last;
        # Needed for OAuth2 to work
        rewrite ^(.*/oauth2/)(.*) 				$1/authorize.php?_REWRITE_COMMAND=$2 last;
		# Needed for custom module faxsms by winginx.com
		#rewrite ^(.*/faxserver)(.*) /fax_serve.php?_FAX=$1 break;
   }

location /oe-module-faxsms { 
	alias	 /usr/local/www/domain.com/interface/modules/custom_modules/oe-module-faxsms;
	error_log  /path/to/logs/faxsms-domain.com.error.log debug;

	location /oe-module-faxsms/faxserver { try_files $uri $uri/ /fax_serve.php$is_args$args; }

	try_files $uri $uri/ /oe-module-faxsms/index.php$is_args$args;

	location ~ \.php$ {
	include fastcgi_params;
	# Added to support REST API/FHIR
        fastcgi_param HTTP_AUTHORIZATION $http_authorization;
        fastcgi_pass   domain.com;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
}
}	
	location = /portal/easy { return 301 /portal/index.php?site=default; }
  
    location / { try_files $uri $uri/ /index.php; }
	
    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html { root   /usr/local/www/nginx-dist; }

    # pass the PHP scripts to FastCGI server listening on php
    #
    location ~ \.php$ {
        # If your app has an upload dir "/images/" then insert 
        # if ($uri !~ "^/images/") before fastcgi_pass,
        # to protect your upload directory:
		#if ($uri !~ "^/images/") { fastcgi_pass domain.com; }
		include fastcgi_params;
		# Added to support REST API/FHIR
        fastcgi_param HTTP_AUTHORIZATION $http_authorization;
        fastcgi_pass   domain.com;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
}

@kkappiah

Try moving this block:

# pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            # 
            # With php-fpm (or other unix sockets):
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

And place it after:

# deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
            deny all;
    }

and before the following line:

    listen [::]:11443 ssl ipv6only=on; # managed by Certbot

In other words, your file needs to look like this:

server {
    listen xxxx;
    listen [::]:xxxx;

    root /var/www/html/openemr;
    index index.html index.php index.htm;

    server_name xxxx.com;

    location / {
            #try_files $uri $uri/ =404;
            try_files $uri $uri/ /index.php$is_args$args;
    }

    #If condition included to handle Patient Portal
    if (!-e $request_filename) {
        # Needed for zend to work
        # rewrite ^(.*/zend_modules/public)(.*) $1/index.php?$is_args$args last;

        # Needed for patient portal to work
        rewrite ^(.*/portal/patient)(.*) $1/index.php?_REWRITE_COMMAND=$1$2 last;

        # Needed for REST API/FHIR to work
        rewrite ^(.*/apis/)(.*) $1/dispatch.php?_REWRITE_COMMAND=$2 last;

        # Needed for OAuth2 to work
        rewrite ^(.*/oauth2/)(.*) $1/authorize.php?_REWRITE_COMMAND=$2 last;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
            deny all;
    }

    # pass PHP scripts to FastCGI server
    #
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            # 
            # With php-fpm (or other unix sockets):
            fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }


listen [::]:11443 ssl ipv6only=on; # managed by Certbot
listen 11443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/xxxx/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/xxxx/privkey.pem; # managed by Certbot

include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
if ($host = xxxx.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


    listen xxxx;

    server_name xxxx.com;
return 404; # managed by Certbot


}

In nginx the order for the PHP block is important!
It really needs to be at the very end of the instructions. What I mean, is the re-writes also need to eventually be sent to the FastCGI server.

But wait, if it was working in openemr version 6, the order should not be a problem.

Also check the php-fpm log please!

1 Like

Hi @gutiersa ,

I have rearranged my nginx conf file like you stated above and restarted nginx but the problem still persists.

I checked php-fpm log and its clean.

I was wondering, in your nginx configuration file, there’s

include openemr.conf

Please did you include the openemr.conf script as part of what you shared earlier? Probably there’s something in there thats making it work.

My OpenEMR instance is being served on a subdomain. So the configuration file i posted is that of the subdomain. Do i need to move any script to the default NGINX configuration file?

1 Like

here is that file:

openemr.conf

# Openemr specific configuration

# deny access to writable files/directories
location ~* ^/sites/default/(documents|edi|era)/ { deny all; return 404; }
location ~* ^/sites/mysite/(documents|edi|era)/ { deny all; return 404; }
location ~* ^/sites/someothersite/(documents|edi|era)/ { deny all; return 404; }
    
# deny access to certain directories
location ~* ^/(contrib|tests) { deny all; return 404; }

# protect special files from outside openemer login, and restrict them to superAdmins only
location ~*^/(admin|setup|acl_setup|acl_upgrade|sl_convert|sql_upgrade|gacl/setup|ippf_upgrade|sql_patch)\.php {
auth_basic "Restricted Access";
auth_basic_user_file ssl/.htpasswd;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass myopenemr.net; include fastcgi_params;
}

# enable CORS for orthanc dicom server, this does not work for fastcgi
#location  /orthanc/  {
#	proxy_pass PHP;
#	proxy_set_header HOST $host;
#	proxy_set_header X-Real-IP $remote_addr;
#	rewrite /orthanc(.*) $1 break;
#	add_header 'Access-Control-Allow-Credentials' 'true';
#	add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X- Requested-With,If-Modified-Since,Cache-Control,Content-Type';
#	add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
#	add_header 'Access-Control-Allow-Origin' '*';
#}

No, I don’t think so.

Check your proxy logs, and your main nginx error and access logs…

@kkappiah
Let me see your main nginx conf file

1 Like

Do you know how to set up nginx for debugging?

You could try that!

Please find my nginx conf file below

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        ##
        #Included to fix upload issues in OpenEMR
        ##
        client_max_body_size 100M;

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

 ##
        # Gzip Settings
        ##

        gzip on;

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # auth_http localhost/auth.php;
#       # pop3_capabilities "TOP" "USER";
#       # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#       server {
#               listen     localhost:110;
#               protocol   pop3;
#               proxy      on;
#       }
#
#       server {
#               listen     localhost:143;
#               protocol   imap;
#               proxy      on;
#       }
#}


1 Like

I am thinking!

Your server_name line is:

server_name xxxx.xxxx.com

not

server_name xxxx.com

Correct?

I mean, if it was working in openemr version 6, then it should work with v 7.
The software should be independent from the server.

Another thing could be permissions. But right now I am not sure where the misc → portal UI is served from.

In your upgrade, you created a whole new directory, then moved your documents to the new install, correct?

I am just going to compare your conf files with mine line by line!

Correct, that’s my server name.

Yes, i agree with you.

Exactly,

Thanks much

1 Like

Here is an important difference, with the explanation.

user www;
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 51200;
# This default error log path is compiled-in to make sure configuration parsing
# errors are logged somewhere, especially during unattended boot when stderr
# isn't normally logged anywhere. This path will be touched on every nginx
# start regardless of error log location configured here. See
# https://trac.nginx.org/nginx/ticket/147 for more info. 
#
error_log  /var/log/nginx/error.log;
#
#pid        logs/nginx.pid;
events {
    worker_connections  1024;
}

It is regarding an error_log directive prior to the HTTP segment.

Here is another difference:

this is my “location /” block in the openemr conf file

location / { 
    try_files $uri $uri/ /index.php; 
}

If you run a google search of

"Oh Snap!" "The page you requested was not found. Please check that you typed the URL correctly."

You get that this is actually an OpenEMR specific error message.
Looks like your nginx configuration may be working as expected!

It would be nice to use the browser developer tools to see what is happening. I don’t really know how to do that.

I have compared our conf files, and nothing else really jumps out at me!

1 Like

Thank you for your help so far. I could check the browser using developer tools. Will report once i find something.

1 Like

Consider turning on debugging:

Administration->Globals->Logging User Debugging Options=>All

1 Like

@gutiersa,

I turned on debugging and didnt find anything in the errorlogs.

1 Like

I am sorry, I had not seen this message.

Did you ever figure this out?

No please i couldn’t. I went with apache