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

Could not bind socket. error #81

Closed
wenxueliu opened this issue Jan 5, 2015 · 2 comments
Closed

Could not bind socket. error #81

wenxueliu opened this issue Jan 5, 2015 · 2 comments

Comments

@wenxueliu
Copy link

$ uname -a
Linux raspberrypi 3.12.28+ #709 PREEMPT Mon Sep 8 15:28:00 BST 2014 armv6l GNU/Linux

$ sudo ./lwan
7122 lwan-job.c:76 lwan_job_thread_init() Initializing low priority job thread.
7122 lwan-response.c:75 lwan_response_init() Initializing default response.
7122 lwan-tables.c:40 lwan_tables_init() Uncompressing MIME type table.
7122 lwan.c:52 lwan_module_init() Initializing module registry.
7122 lwan.c:67 lwan_module_register() Registering module "serve_files".
7122 lwan.c:67 lwan_module_register() Registering module "redirect".
7122 lwan.c:67 lwan_module_register() Registering module "lua".
7122 lwan.c:328 setup_from_config() Loading configuration file: lwan.conf.
7122 lwan.c:442 lwan_init() Could not read config file, using defaults.
7122 lwan.c:445 lwan_init() Initializing lwan web server.
7122 lwan.c:456 lwan_init() Using 2 threads, maximum 2048 sockets per thread.
7122 lwan-thread.c:391 lwan_thread_init() Initializing threads.
7122 lwan-socket.c:226 lwan_socket_init() Initializing sockets.
7122 lwan-socket.c:189 bind_and_listen_addrinfos() Could not bind socket.
7125 lwan-thread.c:288 thread_io_loop() Starting IO loop on thread #2.
7124 lwan-thread.c:288 thread_io_loop() Starting IO loop on thread #1.

@lpereira
Copy link
Owner

lpereira commented Jan 5, 2015

What are your network interfaces? Since Lwan couldn't find the configuration file, it'll try to bind to localhost:8080, and you might not have an entry for localhost in your /etc/hosts file (which is odd but possible). Try copying the lwan.conf file to the directory it is running on, and changing the listener line to read listener *:8080 { so that it tries binding to all interfaces, or listener 127.0.0.1:8080 { if you'd like it to listen only on that particular interface. Please ensure that this interface is up and running (check with either ifconfig or ip).

I'm not sure also if Lwan works under ARM correctly even if it manages to bind to a network interface. Some of the used tricks might only work on x86.

@wenxueliu
Copy link
Author

I have slove the problem by netstat -lntp

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

2 participants