ish icon indicating copy to clipboard operation
ish copied to clipboard

nginx doesn’t work.

Open ghecho opened this issue 6 years ago • 29 comments

I tried to run nginx and it shows “bad system call” when I try to test the config file.

Diegos-iPad:~# nginx -v 
                                                                   
nginx version: nginx/1.14.1  
                                                                                   
Diegos-iPad:~# nginx -t          
                                                                                
Bad system call            
                                                                                      
Diegos-iPad:~# 

ghecho avatar Dec 01 '18 02:12 ghecho

Could you run dmesg and tell me which missing syscall it is?

tbodt avatar Dec 01 '18 02:12 tbodt

of course, give me a sec

ghecho avatar Dec 01 '18 02:12 ghecho

Diegos-iPad:~# dmesg                                                                                             
15 missing syscall 329                                                                                           
15 missing syscall 329

ghecho avatar Dec 01 '18 02:12 ghecho

That's epoll_create1. It's going to be a bit before I get epoll working.

tbodt avatar Dec 01 '18 02:12 tbodt

Ok, thanks. I'll keep playing with the app. Kudos for it. So far I'm super impressed. BTW, that reply speed was totally unexpected

ghecho avatar Dec 01 '18 02:12 ghecho

epoll should be working now. I don't know if that means nginx is fixed though.

tbodt avatar Dec 28 '18 02:12 tbodt

I just tried it and it says:

Diegos-iPad:~# nginx -v                                                                                                                     nginx version: nginx/1.14.1                                                                                                                 Diegos-iPad:~# nginx -t                                                                                                                     Bad system call                                                                                                                             Diegos-iPad:~# dmesg                                                                                                                        3 missing syscall 329

Is the fix coming in a new build? I have build (37)

Sent with GitHawk

ghecho avatar Dec 28 '18 02:12 ghecho

I'm about to push build 38, try again once you've updated.

tbodt avatar Dec 28 '18 02:12 tbodt

Sure, I’ll try that as soon as I install the update

Sent with GitHawk

ghecho avatar Dec 28 '18 02:12 ghecho

It no longer causes a bad system call, it throws an error due to a file not being found but I’m assuming that’s an error in the package, I’ll try later to investigate further.

Sent with GitHawk

ghecho avatar Dec 28 '18 03:12 ghecho

That sounds like it could be #217

tbodt avatar Dec 28 '18 03:12 tbodt

Maybe but I’m guessing it’s an error when nginx tries to call some function to check there’s an instance of nginx running or something like that. There’s no bad system call though, also dmesg returns nothing. The actual error is:

Diego:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok                                            
nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)                          
nginx: configuration file /etc/nginx/nginx.conf test failed                                                 
Diego:~#

I checked and indeed there’s no file there, i manually created one and now when I run “nginx -t” iSH crashes HARD. I tried removing the file but that didn’t help. I had to delete and reinstall the app.

ghecho avatar Dec 28 '18 03:12 ghecho

I tried to run nginx in ISH on my Ipad. At first everything seemed to work well. nginx -t gave me success messages. Nevertheless, the welcome page of nginx was never accessible. The error log read: 2019/11/27 14:03:18 [alert] 223#0 ioctl(FIOASYNC) failed while spawning "worker process"(25:not a tty) I configure worker process auto in nginx.conf. Is this my problem or because ISH doesn't support nginx at present?

michaelfyc avatar Nov 27 '19 14:11 michaelfyc

nginx uses an obscure api for worker processes that ish doesn't support. I know it works with daemon off and worker_process off.

tbodt avatar Nov 27 '19 17:11 tbodt

Thank you for the reply. Daemon off and work _processes off do not produce any error messages in log, but the welcome page of nginx is still inaccessible. I’m sure l’m visiting the right port...

michaelfyc avatar Nov 28 '19 04:11 michaelfyc

How do you start nginx? I looked it up for alpine and rc-service is not a command in ish.

theoparis avatar Dec 28 '19 22:12 theoparis

openrc is not working yet, you have to manually run nginx.

tbodt avatar Dec 28 '19 22:12 tbodt

nginx uses an obscure api for worker processes that ish doesn't support. I know it works with daemon off and worker_process off.

I'm sorry for bumping this issue from last year, but I was also trying to use nginx from iSH a while ago. I had to manually create the /run/nginx/ directory to fix the nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory) error, and I followed the advice by @tbodt quoted above to no avail. The error.log didn't have anything saved from the time I started it to the time I closed it and the access.log is completely empty. dmesg doesn't show any output, so I'm not sure where the issue is coming from.

sn8to avatar Oct 25 '20 15:10 sn8to

I'm trying to run nginx too now, it's running without error but I can't seem to call port 80 or port 81 in the browser.

I tried running a web server using gunicorn on port 8000 and it is working fine. I'm not sure if I miss a configuration for nginx to run properly.

markpanado avatar Oct 25 '20 18:10 markpanado

Those ports are restricted on iOS if I remember correctly. Try using something in the 2000s

ntindle avatar Oct 25 '20 18:10 ntindle

I have given up for nginx to work on iSH for now.

I'll just use python3's http.server to host static html then gunicorn to run REST apis.

python3 -m http.server 80
gunicorn rest:api

markpanado avatar Oct 25 '20 20:10 markpanado

Those ports are restricted on iOS if I remember correctly. Try using something in the 2000s

I had a feeling it had something to do with this. I would say find some way to get past this (other than changing the port number to >1024) but that would most definitely get the app removed from the App Store. Maybe there's some way that the app could reject the port bind calls for anything below 1024 that way users aren't confused about why nginx or any other program is "listening" on that port but not actually working.

sn8to avatar Oct 25 '20 23:10 sn8to

Those ports are restricted on iOS if I remember correctly. Try using something in the 2000s

I had a feeling it had something to do with this. I would say find some way to get past this (other than changing the port number to >1024) but that would most definitely get the app removed from the App Store. Maybe there's some way that the app could reject the port bind calls for anything below 1024 that way users aren't confused about why nginx or any other program is "listening" on that port but not actually working.

I was able to run a webserver on port 80 using this command:

python3 -m http.server 80

markpanado avatar Oct 26 '20 02:10 markpanado

@tbodt or @saagarjha may have to chime in then

ntindle avatar Oct 26 '20 02:10 ntindle

Port 80 is generally allowed, in fact there are app store apps (such as VLC) that run web servers on port 80. More likely nginx is broken.

tbodt avatar Oct 26 '20 02:10 tbodt

nginx version 1.20.2,use nginx -g "master_process off;" to run nginx will be ok.

However, every time you request a backend, you need to switch the task between ISH and browser,It may be that ISH cannot refresh data in the background.

oukanghua avatar Jul 08 '23 15:07 oukanghua

nginx version 1.20.2,use nginx -g "master_process off;" to run nginx will be ok.

However, every time you request a backend, you need to switch the task between ISH and browser,It may be that ISH cannot refresh data in the background.

Try this command to enable running iSH in background

cat /dev/location > /dev/null &

iPhone/iPad may ask you if it's ok to give away your location but it isn't what you think it is.

Rukario avatar Jul 09 '23 18:07 Rukario

nginx version 1.20.2,use nginx -g "master_process off;" to run nginx will be ok. However, every time you request a backend, you need to switch the task between ISH and browser,It may be that ISH cannot refresh data in the background.

Try this command to enable running iSH in background

cat /dev/location > /dev/null &

iPhone/iPad may ask you if it's ok to give away your location but it isn't what you think it is.

thanks,it work.

oukanghua avatar Jul 11 '23 01:07 oukanghua

I have to use @oukanghua ‘s line with master_process off to be able to visit localhost… but I cannot for the life of me figure out the permissions (and ownership) or nginx.conf… I can get indexing to work for a target folder, but when it comes to serving the file the connection immediately dies. I’ve tried /var/www, /usr/share/nginx/html, htdocs, and none work.

steventhestudent avatar Sep 29 '23 04:09 steventhestudent