Unable to access Frappe 14 site on Local Network (VirtualBox)

I set up an Ubuntu 22.04 server on Virtual box and installed frappe (Production setup) in it. I am able to SSH into the server successfully. But I am Unable to access frappe site in my Host PC (I tried accessing usnig the IP). I am getting 404 error site not found. I tried adding site to “currentsite.txt” and turning on DNS multitenancy but both did not work. Can some one kindly help me?

Try

bench use yoursite.com

You also can use bench --site yoursite.com add-to-hosts . This way, this site “domain” will point to your localhost.

Hope this helps.

Did both already. They did not work. Still getting this page:

Hi,

Cab you post the output of vboxmanage showvminfo vm_name or a screenshot of the virtualbox port forwards? The 404 message doesn’t have the port in the ip, what is the url you are entering on the browser address bar?

I am using Ubuntu 22.04 Server OS in Virtual Box. I am using “Bridged Adapter” mode for network in VB. I am entering the IP that I got using “ip a” command in the Virtualbox without the port. The default port is set to 8002 I presume.

ssh into the vm and try: bench setup nginx to see which port.

I don’t see any port number mentioned:

Is nginx running? try: service nginx status

Yes, Nginx is active.

What does bench show-config return in the vm, and netstat -plnt on the host.

Try, in the VM …

curl localhost:8002

What’s the result?

bench show-config
bench_config

netstat -plnt:

curl localhost:8002

what does: bench restart return, in the vm?

webserver is running on 8000 …

curl localhost:8000

curl localhost:8000
image

bench restart
image

Ok, please show your nginx.conf file … /yourbench/config/nginx.conf

nginx.cong file contents:

upstream frappe-bench-frappe {
        server 127.0.0.1:8000 fail_timeout=0;
}

upstream frappe-bench-socketio-server {
        server 127.0.0.1:9000 fail_timeout=0;
}



# setup maps


# server blocks

server {

        listen 80;
        listen [::]:80;


        server_name
                workdone
                ;

        root /home/workdone/frappe-bench/sites;



        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_busy_buffers_size 256k;



        add_header X-Frame-Options "SAMEORIGIN";
        add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header Referrer-Policy "same-origin, strict-origin-when-cross-origin";

        location /assets {
                try_files $uri =404;
        }

        location ~ ^/protected/(.*) {
                internal;
                try_files /$host/$1 =404;
        }

        location /socket.io {
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header X-Frappe-Site-Name $host;
                proxy_set_header Origin $scheme://$http_host;
                proxy_set_header Host $host;

                proxy_pass http://frappe-bench-socketio-server;
        }

        location / {

                rewrite ^(.+)/$ $1 permanent;
                rewrite ^(.+)/index\.html$ $1 permanent;
                rewrite ^(.+)\.html$ $1 permanent;

                location ~* ^/files/.*.(htm|html|svg|xml) {
                        add_header Content-disposition "attachment";
                        try_files /$host/public/$uri @webserver;
                }

                try_files /$host/public/$uri @webserver;
        }

        location @webserver {
                proxy_set_header X-Forwarded-For $remote_addr;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header X-Frappe-Site-Name $host;
                proxy_set_header Host $host;
                proxy_set_header X-Use-X-Accel-Redirect True;
                proxy_read_timeout 120;
                proxy_redirect off;

                proxy_pass  http://frappe-bench-frappe;
        }

        # error pages
        error_page 502 /502.html;
        location /502.html {
                root /usr/local/lib/python3.10/dist-packages/bench/config/templates;
                internal;
        }

        # optimizations
        sendfile on;
        keepalive_timeout 15;
        client_max_body_size 50m;
        client_body_buffer_size 16K;
        client_header_buffer_size 1k;

        # enable gzip compresion
        # based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
        gzip on;
        gzip_http_version 1.1;
        gzip_comp_level 5;
        gzip_min_length 256;
        gzip_proxied any;
        gzip_vary on;
        gzip_types
                application/atom+xml
                application/javascript
                application/json
                application/rss+xml
                application/vnd.ms-fontobject
                application/x-font-ttf
                application/font-woff
                application/x-web-app-manifest+json
                application/xhtml+xml
                application/xml
                font/opentype
                image/svg+xml
                image/x-icon
                text/css
                text/plain
                text/x-component
                ;
                # text/html is always compressed by HttpGzipModule
}

Tried to create a new site, just for testing?