I see my unicorn error file growing, and I can't find out why.
It log some path but when I try them on my browser, I don't see any issue neither redirection.
I'm using rails and this is a snippet of my unicorn production conf file:
stderr_path "log/unicorn.error.log"
stdout_path "log/unicorn.log"
One line from the error log file:
xxx.xxx.xxx.xxx, yyy.yyy.yyy - - [16/Mar/2019:20:13:54 +0100] "GET /fr/yyyyyyy HTTP/1.0" 200 - 0.0926
I thought 200 means that it was OK, but why do I see HTTP/1.0 when my site is only https?
More over, why do I get all those log entries when all the reported errors are working correctly for me?
Is there a way to format log so that I can get more info on error?
HTTP/1.0 is the protocol, this does not imply that your site is not using HTTPS.
By default, the Unicorn logger will write to stderr. So these are not errors, just logs of requests coming in.
Refer this for unicorn configuration options and their meanings - https://github.com/phusion/unicorn/blob/master/examples/unicorn.conf.rb
Related
I got activestorage to work with my rails 5.2 app on localhost.
class Course < ApplicationRecord
has_many_attached :files
I'm using direct-upload and storing to local storage. But when I deploy to the staging server I hit two problems:
Upload is broken
Of the three HTTP requests needed to upload a file:
POST /rails/active_storage/direct_uploads HTTP/1.1
PUT /rails/active_storage/disk/eyJfcmFpbHMi...3aff HTTP/1.1
POST /course/1908/file_update HTTP/1.1
the second request never get's a response. The response should be a simple 204 No Content, but instead it runs into a timeout.
the server setup is:
nginx revers proxy on on machine calls
apache on another machine, which runs
passenger
I can see in the logfile that rails writes that the response for the second
request is actually quite fast:
Started PUT "/rails/active_storage/disk/eyJfcmFpbHMi...
...
Disk Storage (0.8ms) Uploaded file to key: 82L8qxveeux.. (checksum: ..J1BK==)
Completed 204 No Content in 2ms (ActiveRecord: 0.0ms)
Download is broken
When I attache a file to a course via the rails console, and then
try to download the file, I recieve an empty file with the right filename.
Again, the rails logfile seems ok:
Started GET "/rails/active_storage/disk/eyJfcmFpbHMiOn....
...
Completed 200 OK in 1ms (ActiveRecord: 0.0ms)
but somewhere between nginx, apache and passenger the body of the response is lost.
Any ideas what could be at fault here?
Upload is broken
found no explanation but a solution at Nginx reverse proxy causing 504 Gateway Timeout
replace
proxy_set_header Connection "upgrade";
with
proxy_set_header Connection "";
and the timeout goes away, uploading files works.
Download is broken
I found an unexptected Heder in the HTTP response, containing the path of the uploaded file in local storage:
X-Sendfile: /var/www/.../storage/Rj/9o/Rj9oZL9W1jsHrnS7YJyw5
googling X-Sendfile I found an apache module
https://tn123.org/mod_xsendfile/
that takes this Response header and the send the file as the response body.
you can install it on ubuntu / debian with
apt install libapache2-mod-xsendfile
and configure it in apache:
XSendFile On
XSendFilePath /var/www/virthosts....
It seems activestorage uses this by default, but it's
not mentioned anywhere in the documentation.
How do I get Ruby On Rails Webrick to work with self-signed SSL certificate on localhost just to test https ?
Basically, Ived followed the work that has been done here:
Configure WEBrick to use automatically generated self-signed SSL/HTTPS certificate
And produce the script like the following:
require 'webrick'
require 'webrick/https'
cert_name = [
%w[CN localhost],
]
server = WEBrick::HTTPServer.new(:Port => 8000,
:SSLEnable => true,
:SSLCertName => cert_name)
# Shutdown gracefully on signal interrupt CTRL-C
# http://www.ruby-doc.org/core-2.1.1/Kernel.html#method-i-trap
trap('INT') { server.shutdown }
server.start
When I tried to access https://localhost:8000/, it did warn about trust but just went ahead, instead I had nothing come out but this. BTW, https works fine, just it seems its not getting the right route for SSL.
Not Found
`/' not found.
WEBrick/1.3.1 (Ruby/2.1.2/2014-05-08) OpenSSL/1.0.2 at localhost:8000
console prints this:
[2015-07-25 23:38:25] INFO WEBrick::HTTPServer#start: pid=6765 port=8000
[2015-07-25 23:38:32] ERROR `/' not found.
localhost - - [25/Jul/2015:23:38:32 MYT] "GET / HTTP/1.1" 404 284
- -> /
The reason your server is returning that 404 is because the script you've set up is just for an empty WEBrick server; it doesn't actually mount your Rails app. The thread you linked to seemed to be using that script just as a minimal test for the SSL functionality. The full answer to getting WEBrick to work with SSL looks to be answered here: How do you configure WEBrick to use SSL in Rails?
However, I wouldn't recommend you bother. WEBrick is strictly meant as a development-only server, and isn't suitable for use in production (which is why it's hard to get it to do things like use SSL). Instead, either set up nginx as a SSL-serving proxy to your app or use a server which supports SSL easily, like thin does.
I installed a Rails app on the DigitalOcean server, but instead of seeing the app itself, there's the error 500 page.
When I check the directory "logs", there are no data written in the production.log file, or in the unicorn.log.
So, how can I find out what's wrong?
You could try look for nginx's logs in:
/var/log/nginx
usually are placed there:
access.log and error.log
My rails application doesn't response for the address I configured in nginx (No data response. Error 324 (net::ERR_EMPTY_RESPONSE)). Now I'm trying to figure out what the problem could be. Nginx log has per request:
libc++abi.dylib: terminate called throwing an exception
2013/10/21 15:15:30 [alert] 54636#0: worker process 54723 exited on signal 6
If I look into application log - there is no changes, looks, like passenger didn't request something from the app. So I though about another log files, where I could gather some information.
Where does passenger locate its log file?
Is there any special?
Or does passenger use one of the application logs?
In Linux, you can find your log files under
/var/log/nginx/access.log
/var/log/nginx/error.log
Old question, just for the records:
By default Passenger log messages are written to the Nginx global error log.
This exert comes from a recent version. It may not apply before Passenger 5.0.5.
i got passenger error log from /tmp folder(error log in .html format), and i used scp command to copy to my local machine from server
Passenger prints its own logs not only to the terminal, but also to a log file. During startup, Passenger tells you what log file it used. This is typically log/passenger.XXXX.log.
see
https://www.phusionpassenger.com/docs/tutorials/quickstart/ruby/
mine was[3000 was port number for the app] less {app_dir}/log/passenger.3000.log
if the passenger crashes, it shows on the console & passenger.xxxx.log the directory where the log files are
[ pid=2659 ] Crash log files will be dumped to /var/tmp/passenger-crash-log.1583439070.ZfMXhF <--- ******* LOOK HERE FOR DETAILS!!! *******
I have just installed Wamp Server 2 to my pc. and I cannot access phpmyadmin, or even index.php at root directory, it all gives 403 Forbidden.
I have also tried to change permission from alias.conf it did not work.
Do you have any idea how to solve this, or any offer is worth to try, please share.
Thanks in advance.
PS: OS: W7, antivirus KasperSky, windows firewall off.
EDIT: restarting wamp solved phpmyadmin access but directory access (ie: http://localhost/index.php) is still forbidden.
EDIT2: I can now access my index.php through the url: 127.0.0.1/index.php but I cannot still access http://localhost/index.php and I shall use http://localhost/
EDIT3: Logs are full of :
[Fri Apr 13 20:50:06 2012] [error] [client ::1] client denied by server configuration: C:/wamp/www/
[Fri Apr 13 20:50:19 2012] [error] [client ::1] client denied by server configuration: C:/wamp/www/
See my old guide here, many of my friend has this error and this guide works http://www.hieule.info/site/web/solve-the-denied-access-problem-when-using-wamp-server-2-on-windows-8- Hope this works for you too.
I'm planning to use wampserver on windows 8 to run a local only server. I fixed this problem by editing Apache httpd.conf like Trung-Hieu Le (cf.), but only changed one line :
Change
Listen 80
To
Listen 127.0.0.1:80
#Listen 80
This problem with apache configuration. Go to httpd.cong file and replace line number 46 to Listen 127.0.0.1:80. This worked for me.
If it was a firewall problem, you wouldn't even get a 403 error, you'd just get "site is unreachable" from your browser. Check the server error log, it'll explain exactly why it you're getting the error.
I'm guessing it's due to a mis-configured default document with directory browsing disabled - e.g. you've got an index.php in there, but Apache's only looking for index.html by default. With directory browser disabled, you'll get a 403 Forbidden.
chnage localhost to 127.0.0.1 and should work , i had smiler problem :)
::1 - - [11/Nov/2012:14:29:34 +0330] "GET / HTTP/1.1" 403 202
127.0.0.1 - - [11/Nov/2012:14:29:37 +0330] "GET / HTTP/1.1" 200 6051
I had that error and it was caused by having inadvertently deleted the C:\Wamp\Apps folder. Tripped me up because I would have expected a 404 in that case, not a 403.
The simple and most effective sollution in my case and to what I suppose in most of the other cases is all about the access:-
Just follow the following simple step:-
Just Open your httpd.conf file, over there you will see the following
onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Just Change the Deny from All with Allow from All and save the changes and restart all your services in the Wamp server
(Change above with the following)
onlineoffline tag - don't remove
Order Deny,Allow
Allow from all
Allow from 127.0.0.1
No need to change your port or anything else.
Simple and 100% effective
Hope it help others aswell
Go to C:/Windows/System32/drivers/etc/hosts
add a new line with: 127.0.0.1 localhost