NodeJS 0.10.46 not serving after lighttpd proxy anymore - node.js

today I've updated my nodejs installation (from official CentOS 7 repo).
I used to serve via a lighttpd proxy, nothing special:
proxy.server = ( "" =>
( "" =>
(
"host" => "127.0.0.1",
"port" => 2368,
)
)
)
NodeJS itself is working fine, I got two apps running well (if accessed directly), lighttpd also proxying a third app (provided by a Java runtime), that's full functional.
Problem started with NodeJS update to 0.10.46 (via yum package manager), changed nothing on my configuration.
Lighttpd proxy.debug output:
(mod_proxy.c.1158) proxy - start
(mod_proxy.c.1199) proxy - ext found
(mod_proxy.c.1333) proxy - found a host 127.0.0.1 2368
(mod_proxy.c.417) connect delayed: 11
(mod_proxy.c.1042) proxy: fdevent-out 1
(mod_proxy.c.1065) proxy - connect - delayed success
(mod_proxy.c.1030) proxy: fdevent-in 4
(mod_proxy.c.652) proxy - have to read: 0
(mod_proxy.c.1158) proxy - start
(mod_proxy.c.1199) proxy - ext found
(mod_proxy.c.1333) proxy - found a host 127.0.0.1 2368
(mod_proxy.c.417) connect delayed: 11
(mod_proxy.c.1042) proxy: fdevent-out 1
(mod_proxy.c.1065) proxy - connect - delayed success
(mod_proxy.c.1030) proxy: fdevent-in 4
(mod_proxy.c.652) proxy - have to read: 0
NodeJS output:
"GET / HTTP/1.0"
"GET /favicon.ico HTTP/1.0" 200
So request is forwarded in first step, but then only a
500 - Internal Server Error
is delivered by lighttpd.
Any ideas? Don't know what I can try anymore.
Thanks in advance!

First comment to question was the right hint:
lighttpd version were problematic, update to 1.4.43 was the solution.

Node Version
Firstly I'd like to also point out that nodejs 0.10.x is very out of date. NodeJS is currently on v4.5 LTS and v6.5 Current. As the Javascript world moves very rapidly, relying on your distro's packages can leave you stuck with a very old version of node. You can use the nodesource.com service to get a recent build for your system. For example.
curl -sL https://rpm.nodesource.com/setup_4.x | bash -
yum install -y nodejs
Issues to check first
With that out of the way is your NodeJS application available at localhost:2368 ? Try accessing it in your browser (or a text browser like w3m if 2368 isn't open to the outside world). This could be as simple as NodeJS not returning data to the user.
Your lighttpd.conf looks fine however it is nested needlessly deep while this probably won't fix your issues try:
proxy.server = (
"" => (
(
"host" => "127.0.0.1",
"port" => "2368"
)
)
)
Other Possibilities
While I can't know exactly what your system is doing, I would assume this is more likely to be a node issue than a lighty issue. Try writing a simple http server hello world application in node and see if that is available to proxy.

Related

How to proced after ejabberd got installed?

After I have installed Ejabberd (latest version), I tried to test It with Psi, I got always an error "CAN'T CONNECT TO SERVER", after some googling and githubing the issue, I have found that after installing ejabberd I should add some certificates (TLS/SSL DNS records I think), this is what I didn't do, and I don't know how to do that, It's pretty hard(since I'm new to this tech).
Is there any one got the same issue, if true how did you solve it.
Note:I'm running ejabberd & Psi on the same machine, Windows 10
The ejabberd binary installers (at least the 18.12 linux installer) includes a self-signed certificate. Check your configuration file, and probably it already has the certificate configured, and something like this:
-
port: 5222
ip: "::"
module: ejabberd_c2s
max_stanza_size: 262144
shaper: c2s_shaper
access: c2s
starttls_required: true
Remember to tell your client to use encryption (probably already enabled). Also, tell your client where the server is: In Psi, go to Account Setup -> Modify -> Connection -> Manually Specify Server Host/Port: 127.0.0.1 Port: 5222.
That wouldn't be necessary if you configure properly DNS.

Can't connect to Jekyll's localhost:4000 on Windows 10

I'm trying to set up Jekyll on my Windows 10 machine, but can't connect to the website (127.0.0.1:4000) that is created by jekyll serve (or bundle exec jekyll serve). I have followed all the steps in Julian Thilo's Run Jekyll on Windows without any error messages. And when I run jekyll serve in PowerShell from my Jekyll website folder everything seems just fine:
Configuration file: C:/Users/fredr/dropbox/github/jekyll-website/_config.yml
Source: C:/Users/fredr/dropbox/github/jekyll-website
Destination: C:/Users/fredr/dropbox/github/jekyll-website/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.457 seconds.
Auto-regeneration: enabled for 'C:/Users/fredr/dropbox/github/jekyll-website'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
But when I open http://127.0.0.1:4000 (or http://localhost:4000) in my browser, the connection fails.
When I run netstat -an, the port 4000 is listed as
Proto Local Address Foreign Address State
TCP 127.0.0.1:4000 0.0.0.0:0 LISTENING
I have previously managed to set up a localhost using IIS, but that website is stopped now.
This Github issue seems related, but doesn't contain enough information for me to figure out how the problem was solved. It only says to use the "Jekyll on windows package", but I can't find any information on that.
Following in #Fredrik P's footsteps, I CD'd into the project's _site folder (this is where the home folder of the server should be) and ran a Python 3.x simple HTTP server:
D:\frida\frida-website\_site>python -m http.server 3999
Serving HTTP on 0.0.0.0 port 3999 (http://0.0.0.0:3999/) ...
Now pointing my browser to http://0.0.0.0:3999/ works like a charm.
If you need to use Python 2.x, the HTTP server command would be:
python -m SimpleHTTPServer 3999
For more information regarding SimpleHTTPServer (2.x) and http.server (3.x), see this Stack Overflow post.
Until some better solution pops up, I will just host the _site folder with IIS. Not as fancy pancy but works like a charm :)

Chef-Server Installation can't find chef service

I am installing chef-server on this VPS that my friend let me borrow.
I was able to install chef and run chef-server-ctl reconfigure successfully.
I ran into problems because I need to change the iptable rules and I discovered that I cannot find chef-server running on any port or as a service.
When I run chef-server-ctl it seems to pass all the tests, so I know its API is working.
Where can I find that chef is running?
I need to change my iptables so that I can use knife to communicate with chef-server.
First off it sounds like you installed Chef Server, not Chef, important distinction :) Second, there is no specific process called chef-server. The frontend routing is handled by nginx which binds on port 443 and 80 (80 is just a redirector to 443 and can be blocked or disabled if desired). Internally we have a bunch of different smaller services like oc_erchef, bifrost, oc_id, etc. These all listen on localhost and are reached via Nginx.
You have installed Chef server and have reconfigured the server, you can't find a chef-server.
you can run below commands to check all the services that are running chef server
$ chef-server-ctl service-list
bookshelf*
nginx*
oc_bifrost*
oc_id*
opscode-chef-mover*
opscode-erchef*
opscode-expander*
opscode-solr4*
rabbitmq*
redis_lb*
postgresql*
To update the port number you need to update
/etc/chef-server/chef-server.rb - in Chef 11
/etcopscode/chef-server.rb - in Chef 12
nginx['non_ssl_port'] = portnumber
And also how are using knife command? Do you want ssl check to be passed then you need to add a line in knife.rb file
ssl_verify_mode: verify_none
'

403 Forbidden after successfully installing Ghost

I have been spending days figuring out how to install the viral Ghost platform, and experienced numerous errors. Luckily, I have managed to install it - Ghost gives me a positive Ghost is running... message in SSH after I've done npm start --production. However, when I browse to my website - http://nick-s.se - Apache displays its default page and when I go to the ghost login area - /ghost, the site returns a 403 Forbidden.
P.S. I have specifically installed Ghost on a different port than the one Apache is running on. I don't know what's going on...
Update - I have found out that I can access my Ghost installation by adding the port number 2368 which I've configured in the config.js. Now, however my problem is - how can I run Ghost without using such ports?...
tell your browser you want to connect to the port Ghost is running on: http://nick-s.se:2368
So a few things, based on visiting:
1) It seems Apache isn't proxying the request onward to Ghost. Are you sure that you've configured it properly?
2) It also looks like Apache doesn't have access to the directory that you set as root. This shouldn't be necessary anyway if proxying is set up correctly, but could become an issue later if you wanted to use apache to serve things like the static assets.
If you are open to nginx instead of Apache, I have written a how to on this: link. You can skip the section on configuring Nginx. Otherwise, still might be useful if you figure out the conversion of rules from Nginx to Apache.
If you don't have any other sites running on your VPS you can just turn apache off and not have to deal with apache proxying the request to port 2368 and have Ghost run on port 80. If your VPS is running CentOS you can check out this how to on disabling apache and running Ghost on port 80.

Not getting remote address while using proxy in socket.io

In my socket.io code,
socket.sockets.on('connection', function(client){
var ip = client.handshake.address.address;
..
}
ip always returns 127.0.0.1 and this is because the server sits behind a proxy.
How do I get remote address properly ?
Edit: I am using http-proxy
yes, this is working for me.
client.handshake.headers['x-forwarded-for'] || client.handshake.address.address;
I am properly getting the remote IP address and not 127.0.0.1
In version > 1.0, the syntax is similar:
socket.handshake.headers['x-forwarded-for'] || socket.request.connection.remoteAddress;
For people who may come from Google, using NGINX: none of these worked for me, I followed the answer in this other question and modified my proxy_pass, to create a new header that node could then use. Don't forget to call sudo systemctl restart nginx after.

Resources