Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Cannot access from mobile #32

djbarnat · · author
#1

Hi, firstly thank you rompr is superb. Love the design.

I have a problem where if i can access rompr no problem from all my desktop PC's / laptops, but not from my phone. I have tried http://192.168.x.x address and this takes me to the niginx welcome page. Myrompr.net gives a DNS resolution error which I think is expected an an Android device. I have looked through the docs and discussion forum. It's quite possible I have missed something but what URL should I be using on mobile?

  • replies 8
  • views 1.1K
  • likes 0
#2

Yes sadly the DNS thing won’t work from an Android device.

If you’re seeing the nginx welcome page that implies you should be going to http://192.168.x.x/rompr

djbarnat · · author

Hi Mark,

I really appreciate you responding so quickly on this, thank you.

I did already try it with http://192.168.x.x/rompr and if i do that i get the 404.php

Not sure if it helps but his is the /etc/nginx/sites-available/rompr
server {

listen 80 default_server;
listen [::]:80 default_server;

root /home/pi/web/rompr;
index index.php index.html index.htm;

server_name www.myrompr.net;

client_max_body_size 256M;

# This section can be copied into an existing default setup
location / {
    allow all;
    index index.php;
    location ~ \.php {
            try_files $uri index.php =404;
            fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            include /etc/nginx/fastcgi_params;
            fastcgi_read_timeout 1800;
    }
    error_page 404 = /404.php;
    try_files $uri $uri/ =404;
    location ~ /albumart/* {
            expires -1s;
    }
}

}

#4

Sometimes I regret making the instructions set it up as the default site :) It does seem to cause more problems than it solves.

I don't have an Android device here to test it with, but let's try this instead.

Change the following:

root /home/pi/web


location /rompr {

You'll probably also need to remove the server_name line.

Then restart nginx

Then you should be able to access it at http://192.168.x.x/rompr from every device (and www.myrompr.net won't work but that's not really important)

djbarnat · · author
#5

Hi i updated as below

server {

    listen 80 default_server;
    listen [::]:80 default_server;

    root /home/pi/web;
    index index.php index.html index.htm;

    #server_name www.myrompr.net;

    client_max_body_size 256M;

    # This section can be copied into an existing default setup
    location /rompr {
        allow all;
        index index.php;
        location ~ \.php {
                try_files $uri index.php =404;
                fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                include /etc/nginx/fastcgi_params;
                fastcgi_read_timeout 1800;
        }
        error_page 404 = /404.php;
        try_files $uri $uri/ =404;
        location ~ /albumart/* {
                expires -1s;
        }
    }
}

Restarted nginx

sudo systemctl restart nginx

Now i try to access from http://192.168.1.103/rompr i get the 404 page from nginx server on both laptop and mobile.

#6

send send me the output of

ls -al /etc/nginx/sites-enabled

And the contents of /etc/nginx/sites-available/default

Also which Linux district you are using.

djbarnat · · author
#7

Ok, now i feel rather silly :)

pi@raspberrypi:~ $ ls -al /etc/nginx/sites-enabled
total 8
drwxr-xr-x 2 root root 4096 Jul 21 21:18 .
drwxr-xr-x 8 root root 4096 Jul 21 21:18 ..
lrwxrwxrwx 1 root root   34 Jul 21 21:18 default -> /etc/nginx/sites-available/default

Light sparks in brain, re-RTFM.

sudo ln -s /etc/nginx/sites-available/rompr /etc/nginx/sites-enabled/rompr

then

sudo systemctl restart nginx

Rompr now accessable from all clients.

Thanks for your help on this! Very pleased it's all working

OS is raspbian btw not that this is hugely relevant anymore given my less the perfect following of the instructions!

djbarnat · · author
#8

Im not sure how it was working before on my laptop without this symlink though

#9

No worries, glad it was simple to sort out. I do wish there was an easier way to set it up but web servers are not simple beasts.

As to why it worked from your laptop, who knows? Nginx is a dark and complex art and my instructions are only the very minimum you need to do or understand.