You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/07/23 09:30:41 UTC
[GitHub] [incubator-apisix] poidl opened a new issue #1893: Documentation on listening to port 80?
poidl opened a new issue #1893:
URL: https://github.com/apache/incubator-apisix/issues/1893
Version 1.4
I'm a beginner and tried using
```
node_listen: 80
```
in ` conf/config.yaml`. The objective is simply to use APISIX for a publicly available home page.
```
sudo ./bin/apisix start`
```
errors with
```
2020/07/23 11:17:24 [error] 26714#0: init_worker_by_lua error: ...er/programs/apache-apisix-1.4-incubating/apisix/init.lua:72: module 'resty.worker.events' not found:
no field package.preload['resty.worker.events']
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/share/lua/5.1/resty/worker/events.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/share/lua/5.1/resty/worker/events/init.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating/resty/worker/events.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating/resty/worker/events/init.lua'
no file '/usr/local/openresty/site/lualib/resty/worker/events.ljbc'
no file '/usr/local/openresty/site/lualib/resty/worker/events/init.ljbc'
no file '/usr/local/openresty/lualib/resty/worker/events.ljbc'
no file '/usr/local/openresty/lualib/resty/worker/events/init.ljbc'
no file '/usr/local/openresty/site/lualib/resty/worker/events.lua'
no file '/usr/local/openresty/site/lualib/resty/worker/events/init.lua'
no file '/usr/local/openresty/lualib/resty/worker/events.lua'
no file '/usr/local/openresty/lualib/resty/worker/events/init.lua'
no file './resty/worker/events.lua'
no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta3/resty/worker/events.lua'
no file '/usr/local/share/lua/5.1/resty/worker/events.lua'
no file '/usr/local/share/lua/5.1/resty/worker/events/init.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/resty/worker/events.lua'
no file '/usr/local/openresty/luajit/share/lua/5.1/resty/worker/events/init.lua'
no file '/usr/share/lua/5.3/resty/worker/events.lua'
no file '/usr/share/lua/5.3/resty/worker/events/init.lua'
no file '/usr/lib/lua/5.3/resty/worker/events.lua'
no file '/usr/lib/lua/5.3/resty/worker/events/init.lua'
no file './resty/worker/events.lua'
no file './resty/worker/events/init.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib64/lua/5.1/resty/worker/events.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib/lua/5.1/resty/worker/events.so'
no file '/usr/local/openresty/site/lualib/resty/worker/events.so'
no file '/usr/local/openresty/lualib/resty/worker/events.so'
no file './resty/worker/events.so'
no file '/usr/local/lib/lua/5.1/resty/worker/events.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/resty/worker/events.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/lib/lua/5.3/resty/worker/events.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './resty/worker/events.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib64/lua/5.1/resty.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib/lua/5.1/resty.so'
no file '/usr/local/openresty/site/lualib/resty.so'
no file '/usr/local/openresty/lualib/resty.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/usr/local/openresty/luajit/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/lib/lua/5.3/resty.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './resty.so'
stack traceback:
[C]: in function 'require'
...er/programs/apache-apisix-1.4-incubating/apisix/init.lua:72: in function 'http_init_worker'
init_worker_by_lua:2: in main chunk
```
I read this issue
#https://github.com/apache/incubator-apisix/issues/1693
where it says that nginx shouldn't be run as root.
I read some forum posts, e.g.
https://superuser.com/questions/710253/allow-non-root-process-to-bind-to-port-80-and-443
and tried using
```
sudo setcap CAP_NET_BIND_SERVICE=+ep /usr/local/openresty/nginx/sbin/nginx
```
This works. I also have control over my firewall and could do port remapping. Another suggesting in that forum post is `authbind`, which I have not tried.
Do the APISIX developers suggest a specific way? Or should this already work with `sudo`, and maybe I have not understood how to do it? Is port remapping via `iptables` the best way?
Thanks!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] moonming commented on issue #1893: Documentation on listening to port 80?
Posted by GitBox <gi...@apache.org>.
moonming commented on issue #1893:
URL: https://github.com/apache/incubator-apisix/issues/1893#issuecomment-663308659
How did you install Apache APISIX? Seems like Apache APISIX can't find the dependency: resty.worker.events
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] membphis closed issue #1893: Documentation on listening to port 80?
Posted by GitBox <gi...@apache.org>.
membphis closed issue #1893:
URL: https://github.com/apache/incubator-apisix/issues/1893
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] membphis commented on issue #1893: Documentation on listening to port 80?
Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1893:
URL: https://github.com/apache/incubator-apisix/issues/1893#issuecomment-664319053
you need to install APISIX to `/usr/local/apisix`, and set right access permissions. then you can start the APISIX with `sudo`.
the user is `nobody` by default if you start APISIX with `sudo`, from the error log, it is caused by not having permission to read the file.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] poidl edited a comment on issue #1893: Documentation on listening to port 80?
Posted by GitBox <gi...@apache.org>.
poidl edited a comment on issue #1893:
URL: https://github.com/apache/incubator-apisix/issues/1893#issuecomment-663389954
Thanks for your help! To make it more reproducible I re-installed and attached an install script below. This installs to an unpriviliged user's home directory (note the `configure --prefix` for `openresty` and `luarocks` in the install script).
With a default `config.yaml` listening on port 9080, this works without error:
```
./bin/apisix start
```
But
```
sudo ./bin/apisix start
```
results in (`cat logs/error.log`)
```
2020/07/24 09:31:03 [error] 11080#0: init_worker_by_lua error: ...er/programs/apache-apisix-1.4-incubating/apisix/init.lua:72: module 'resty.worker.events' not found:
no field package.preload['resty.worker.events']
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/share/lua/5.1/resty/worker/events.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/share/lua/5.1/resty/worker/events/init.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating/resty/worker/events.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating/resty/worker/events/init.lua'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events.ljbc'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events/init.ljbc'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events.ljbc'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events/init.ljbc'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events/init.lua'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events/init.lua'
no file './resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/luajit/share/luajit-2.1.0-beta3/resty/worker/events.lua'
no file '/usr/local/share/lua/5.1/resty/worker/events.lua'
no file '/usr/local/share/lua/5.1/resty/worker/events/init.lua'
no file '/home/labuser/programs/openresty_install/luajit/share/lua/5.1/resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/luajit/share/lua/5.1/resty/worker/events/init.lua'
no file '/usr/share/lua/5.3/resty/worker/events.lua'
no file '/usr/share/lua/5.3/resty/worker/events/init.lua'
no file '/usr/lib/lua/5.3/resty/worker/events.lua'
no file '/usr/lib/lua/5.3/resty/worker/events/init.lua'
no file './resty/worker/events.lua'
no file './resty/worker/events/init.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib64/lua/5.1/resty/worker/events.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib/lua/5.1/resty/worker/events.so'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events.so'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events.so'
no file './resty/worker/events.so'
no file '/usr/local/lib/lua/5.1/resty/worker/events.so'
no file '/home/labuser/programs/openresty_install/luajit/lib/lua/5.1/resty/worker/events.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/lib/lua/5.3/resty/worker/events.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './resty/worker/events.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib64/lua/5.1/resty.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib/lua/5.1/resty.so'
no file '/home/labuser/programs/openresty_install/site/lualib/resty.so'
no file '/home/labuser/programs/openresty_install/lualib/resty.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/home/labuser/programs/openresty_install/luajit/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/lib/lua/5.3/resty.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './resty.so'
stack traceback:
[C]: in function 'require'
...er/programs/apache-apisix-1.4-incubating/apisix/init.lua:72: in function 'http_init_worker'
init_worker_by_lua:2: in main chunk
```
In the github issue referenced above, a user said that nginx is `nobody` when apisix is started with sudo, and so it doesn't have permissions to read the lua configuration (if I understand correctly).
Install script:
```
#!/bin/bash -e
# dependencies include: wget make gcc lua unzip which git
BASE=/home/labuser/programs
cd ~/programs
REL=openresty-1.15.8.3
wget -nc https://openresty.org/download/$REL.tar.gz
tar -xzf $REL.tar.gz
rm -r openresty_install ||:
mkdir openresty_install
cd $REL/
./configure -j2 --prefix=$BASE/openresty_install \
--with-file-aio \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-mail \
--with-mail_ssl_module \
--with-luajit \
--with-pcre-jit \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module \
--with-http_iconv_module
make -j2
sudo make install
cd ..
################################################
REL=luarocks-3.3.1
wget -nc https://luarocks.org/releases/$REL.tar.gz
tar zxpf $REL.tar.gz
rm -r luarocks_install ||:
mkdir luarocks_install
cd $REL
./configure --prefix=$BASE/luarocks_install
make
sudo make install
cd ..
# #####################################################################
cd $BASE
wget -nc http://www.apache.org/dist/incubator/apisix/1.4/apache-apisix-1.4-incubating-src.tar.gz
tar zxvf apache-apisix-1.4-incubating-src.tar.gz
cd apache-apisix-1.4-incubating
make deps
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [incubator-apisix] poidl commented on issue #1893: Documentation on listening to port 80?
Posted by GitBox <gi...@apache.org>.
poidl commented on issue #1893:
URL: https://github.com/apache/incubator-apisix/issues/1893#issuecomment-663389954
Thanks for your help! To make it more reproducible I re-installed and attached an install script below. This installs to an unpriviliged user's home directory (note the `configure --prefix` for `openresty` and `luarocks` in the install script).
This works without error:
```
./bin/apisix start
```
But
```
sudo ./bin/apisix start
```
results in (`cat logs/error.log`)
```
2020/07/24 09:31:03 [error] 11080#0: init_worker_by_lua error: ...er/programs/apache-apisix-1.4-incubating/apisix/init.lua:72: module 'resty.worker.events' not found:
no field package.preload['resty.worker.events']
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/share/lua/5.1/resty/worker/events.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/share/lua/5.1/resty/worker/events/init.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating/resty/worker/events.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating/resty/worker/events/init.lua'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events.ljbc'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events/init.ljbc'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events.ljbc'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events/init.ljbc'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events/init.lua'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events/init.lua'
no file './resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/luajit/share/luajit-2.1.0-beta3/resty/worker/events.lua'
no file '/usr/local/share/lua/5.1/resty/worker/events.lua'
no file '/usr/local/share/lua/5.1/resty/worker/events/init.lua'
no file '/home/labuser/programs/openresty_install/luajit/share/lua/5.1/resty/worker/events.lua'
no file '/home/labuser/programs/openresty_install/luajit/share/lua/5.1/resty/worker/events/init.lua'
no file '/usr/share/lua/5.3/resty/worker/events.lua'
no file '/usr/share/lua/5.3/resty/worker/events/init.lua'
no file '/usr/lib/lua/5.3/resty/worker/events.lua'
no file '/usr/lib/lua/5.3/resty/worker/events/init.lua'
no file './resty/worker/events.lua'
no file './resty/worker/events/init.lua'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib64/lua/5.1/resty/worker/events.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib/lua/5.1/resty/worker/events.so'
no file '/home/labuser/programs/openresty_install/site/lualib/resty/worker/events.so'
no file '/home/labuser/programs/openresty_install/lualib/resty/worker/events.so'
no file './resty/worker/events.so'
no file '/usr/local/lib/lua/5.1/resty/worker/events.so'
no file '/home/labuser/programs/openresty_install/luajit/lib/lua/5.1/resty/worker/events.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/lib/lua/5.3/resty/worker/events.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './resty/worker/events.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib64/lua/5.1/resty.so'
no file '/home/labuser/programs/apache-apisix-1.4-incubating//deps/lib/lua/5.1/resty.so'
no file '/home/labuser/programs/openresty_install/site/lualib/resty.so'
no file '/home/labuser/programs/openresty_install/lualib/resty.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/home/labuser/programs/openresty_install/luajit/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/usr/lib/lua/5.3/resty.so'
no file '/usr/lib/lua/5.3/loadall.so'
no file './resty.so'
stack traceback:
[C]: in function 'require'
...er/programs/apache-apisix-1.4-incubating/apisix/init.lua:72: in function 'http_init_worker'
init_worker_by_lua:2: in main chunk
```
In the github issue referenced above, a user said that nginx is `nobody` when apisix is started with sudo, and so it doesn't have permissions to read the lua configuration (if I understand correctly).
Install script:
```
#!/bin/bash -e
# dependencies include: wget make gcc lua unzip which git
BASE=/home/labuser/programs
cd ~/programs
REL=openresty-1.15.8.3
wget -nc https://openresty.org/download/$REL.tar.gz
tar -xzf $REL.tar.gz
rm -r openresty_install ||:
mkdir openresty_install
cd $REL/
./configure -j2 --prefix=$BASE/openresty_install \
--with-file-aio \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-mail \
--with-mail_ssl_module \
--with-luajit \
--with-pcre-jit \
--with-http_v2_module \
--with-stream \
--with-stream_ssl_module \
--with-http_iconv_module
make -j2
sudo make install
cd ..
################################################
REL=luarocks-3.3.1
wget -nc https://luarocks.org/releases/$REL.tar.gz
tar zxpf $REL.tar.gz
rm -r luarocks_install ||:
mkdir luarocks_install
cd $REL
./configure --prefix=$BASE/luarocks_install
make
sudo make install
cd ..
# #####################################################################
cd $BASE
wget -nc http://www.apache.org/dist/incubator/apisix/1.4/apache-apisix-1.4-incubating-src.tar.gz
tar zxvf apache-apisix-1.4-incubating-src.tar.gz
cd apache-apisix-1.4-incubating
make deps
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org