Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx doesn’t work. #137

Open
ghecho opened this issue Dec 1, 2018 · 29 comments
Open

nginx doesn’t work. #137

ghecho opened this issue Dec 1, 2018 · 29 comments
Assignees

Comments

@ghecho
Copy link

ghecho commented Dec 1, 2018

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:~# 
@tbodt
Copy link
Member

tbodt commented Dec 1, 2018

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

@ghecho
Copy link
Author

ghecho commented Dec 1, 2018

of course, give me a sec

@ghecho
Copy link
Author

ghecho commented Dec 1, 2018

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

@tbodt
Copy link
Member

tbodt commented Dec 1, 2018

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

@ghecho
Copy link
Author

ghecho commented Dec 1, 2018

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

@tbodt
Copy link
Member

tbodt commented Dec 28, 2018

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

@ghecho
Copy link
Author

ghecho commented Dec 28, 2018

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

@tbodt
Copy link
Member

tbodt commented Dec 28, 2018

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

@ghecho
Copy link
Author

ghecho commented Dec 28, 2018

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

Sent with GitHawk

@ghecho
Copy link
Author

ghecho commented Dec 28, 2018

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

@tbodt
Copy link
Member

tbodt commented Dec 28, 2018

That sounds like it could be #217

@ghecho
Copy link
Author

ghecho commented Dec 28, 2018

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.

@michaelfyc
Copy link

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?

@tbodt
Copy link
Member

tbodt commented Nov 27, 2019

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

@michaelfyc
Copy link

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...

@theoparis
Copy link

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

@tbodt
Copy link
Member

tbodt commented Dec 28, 2019

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

@sn8to
Copy link

sn8to commented Oct 25, 2020

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.

@markpanado
Copy link

markpanado commented Oct 25, 2020

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.

@ntindle
Copy link

ntindle commented Oct 25, 2020

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

@markpanado
Copy link

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

@sn8to
Copy link

sn8to commented Oct 25, 2020

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.

@markpanado
Copy link

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

@ntindle
Copy link

ntindle commented Oct 26, 2020

@tbodt or @saagarjha may have to chime in then

@tbodt
Copy link
Member

tbodt commented Oct 26, 2020

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.

@oukanghua
Copy link

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.

@Rukario
Copy link

Rukario commented Jul 9, 2023

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.

@oukanghua
Copy link

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.

@steventhestudent
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants