My lapis server keeps throwing "error 500 Internal Server Error" - nginx

I have been experimenting with the lua web framework, lapis, recently. My issue is that when I run lapis server, and try to connect to the website via my browser (localhost:8081), I receive the following error: 500 Internal Server Error. In the logs I get a whole spew of errors:
coroutine 0:
[C]: in function 'require'
content_by_lua(nginx.conf.compiled:22):2: in main chunk, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8081"
2022/08/19 16:54:44 [error] 46270#4681084: *3 lua entry thread aborted: runtime error: content_by_lua(nginx.conf.compiled:22):2: module 'lapis' not found:
no field package.preload['lapis']
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis.ljbc'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis/init.ljbc'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis.ljbc'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis/init.ljbc'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis.lua'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis/init.lua'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis.lua'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis/init.lua'
no file './lapis.lua'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/share/luajit-2.1.0-beta3/lapis.lua'
no file '/usr/local/share/lua/5.1/lapis.lua'
no file '/usr/local/share/lua/5.1/lapis/init.lua'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/share/lua/5.1/lapis.lua'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/share/lua/5.1/lapis/init.lua'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/site/lualib/lapis.so'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/lualib/lapis.so'
no file './lapis.so'
no file '/usr/local/lib/lua/5.1/lapis.so'
no file '/opt/homebrew/Cellar/openresty/1.21.4.1_1/luajit/lib/lua/5.1/lapis.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
This is weird as I have all of these things installed. Does anyone know what the root of my problem might be?

lapis work on luajit 5.1 only. You might have 5.2 or 5.3 installed. Make sure you pin the version to 5.1 while installing.

Related

Passenger Looking for Permissions on a Missing File

Linux installation of Phusion Passenger(R) 6.0.14 on nginx/1.14.1. I'm not able to load a site (on a simplified nginx.conf with the conf.d/passenger.conf and conf.d/site1.conf includes. That error:
2022/08/03 19:24:34 [alert] 55601#0: *3 Error opening '/home/user3/sites/Passengerfile.json' for reading: Permission denied (errno=13);
This error means that the Nginx worker process (PID 55601, running as UID 992) does not have permission to access this file.
Please read this page to learn how to fix this problem: https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=upon-accessing-the-web-app-nginx-reports-a-permission-denied-error;
Extra info, client: 192.168.1.4, server: domain1.com, request: "GET / HTTP/1.1", host: "server_f.local"
I don't even know what to ask, other than how can I get this to work? That file doesn't exist. I've restarted nginx many times, and this is the only feedback that I get. I've checked over that page, which tells me to look at the error log it's reported in already. The host and server are correct, and I am on my LAN.

.NET Core WebAPI - AWS ElasticBeanstalk Nginx Configuration

I've moved my .NET Core WebAPI to an AWS EB Instance. This works fine, however my file upload has now broken due to the Nginx 'client_max_body_size' configuration.
I've looked up how to override this, however I cannot get this to work. Here is my current set-up:
Within this file I have added:
client_max_body_size 0;
This file has no hidden characters (Notepad++ with show all chars on):
When my EB environment is updated I get the following eb-engine log:
2022/05/17 07:15:57.025994 [ERROR] An error occurred during execution of command [app-deploy] - [FlipProxyForDotNetCore]. Stop running the command. Error: copy proxy conf from staging failed with error validate nginx configuration failed with error Command /bin/sh -c /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf failed with error exit status 1. Stderr:nginx: [emerg] unknown directive "client_max_body_size" in /var/proxy/staging/nginx/conf.d/myConf.conf:1
nginx: configuration file /var/proxy/staging/nginx/nginx.conf test failed
My EB instance is running Amazon Linux 2/2.3.1.
What am I doing wrong?
The error msg
"client_max_body_size"
indicates that you have some non-ASCII characters () in your myConf.conf. Please open the file in a regular text editor and verify that it has only ASCII characters.

Rails 4.2 + NGINX - application root won't load

My server setup works for a Rails 4.0 app, but fails on a 4.2 app. I get this error:
An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
If you are the system administrator of this resource then you should check the error log for details.
NGINX config:
server {
listen 80;
server_name localhost;
passenger_enabled on;
rails_env production;
root /home/deploy/myapp/current/public;
}
NGINX error.log:
2014/10/13 16:17:06 [error] 9261#0: *9 upstream prematurely closed connection while reading response header from upstream, client: ***.***.***.***, server: localhost, request: "GET / H$
Rails production.log:
W, [2014-10-13T16:11:57.305892 #10891] WARN -- : Warning. Error encountered while saving cache a4b17298d22d34199795f642dc5b96ec8d58cc6c/orders.css.scssc: can't dump anonymous class #<$
W, [2014-10-13T16:11:57.314170 #10891] WARN -- : Warning. Error encountered while saving cache a4b17298d22d34199795f642dc5b96ec8d58cc6c/pages.css.scssc: can't dump anonymous class #<C$
W, [2014-10-13T16:11:57.319744 #10891] WARN -- : Warning. Error encountered while saving cache a4b17298d22d34199795f642dc5b96ec8d58cc6c/registrations.css.scssc: can't dump anonymous c$
If I manually put in an index.html file in the public directory, I can see that. But it fails when I want to go to the root path of the app. Any ideas?
OK so this is a bit embarrassing. To further troubleshoot my application, I started in production mode on my local machine, and when I loaded the app I got the following error on the web page:
Missing `secret_key_base` for 'production' environment, set this value in `config/secrets.yml`
So that was it. I guess I missed this new security feature by jumping straight from Rails 4.0 to 4.2 Not sure why it didn't show in the logs, but at least I found it eventually.

can't find buffered temporary file of nginx

I got following warning from Nginx error log when I'm uploading a large file (5GB),
2014/06/09 22:30:13 [warn] 14170#0: *3 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000000001, client: 10.170.24.90, server: 127.0.0.1, request: "POST files/test_file HTTP/1.1", host: "10.119.140.39"
The interesting part is I can't find the temporary file /var/cache/nginx/client_temp/0000000001
ls: cannot access /var/cache/nginx/client_temp/0000000001: No such file or directory
All the temp path settings are default, anyone knows where to find the temp file?
Temp file was deleted immediately after sending it to backend or after closing client`s session if file wasn`t uploaded.
If you can`t uploading file, check if nginx has access to write into /var/cache/nginx/client_temp/.

PHP Fatal error with nginx

I'm having, in a PHP form, when I'm submiting one email as a suscriber in a Wordpress theme, the next error in error.log:
2013/08/03 21:39:22 [error] 19544#0: *11 FastCGI sent in stderr: "PHP message: PHP Warning: require_once(TEMPLATEPATH/functions/theme-functions.php): failed to open stream: No such file or directory in /web/domain.com/public/wp-content/themes/launcheffect/functions.php on line 151
PHP message: PHP Fatal error: require_once(): Failed opening required 'TEMPLATEPATH/functions/theme-functions.php' (include_path='.:/usr/share/php:/usr/share/pear') in /web/domain.com/public/wp-content/themes/launcheffect/functions.php on line 151" while reading response header from upstream, client: 71.28.74.212, server: www.domain.com, request: "POST /wp-content/themes/launcheffect/post.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com", referrer: "http://www.domain.com/"
I've been reading about permissions, about nginx and fastcgi, about PHPfpm, reviewing my config...without success. More, I've other sites working perfectly, and that theme worked well some days ago.
Of course I've that file/directory.
My nginx.conf:
http://pastebin.com/5VB1BzHj
Can anyone help me to solve this error?
Thanks in advance!
Looking at your example error it appears you are not formatting the require correctly. It should look something like this:
require_once(TEMPLATEPATH . '/functions/theme-functions.php');
Make certain that you are also defining your TEMPLATEPATH.
define("TEMPLATEPATH ", "/this/is/your/path");
In the end, this should output a string:
/this/is/your/path/functions/theme-functions.php
For anyone having this problem, double check your file paths and file names as mine was caused by a case sensitive file path where I had missed an Uppercase letter

Resources