sailsjs refuses connection on address localhost - angularjs

I am developing an app consisting sailsjs in backend and ng-boilerplate in frontend. In my dev machine(64 bit ubuntu) is all working. But when I put my app for testing purposes into a 32bit debian machine, sailsjs is refusing connection on address
http://localhost:1337/blog.
When I replace localhost with hostname of my debian-machine, like that:
http://debian:1337/blog, all is going to work.
This is error message in browser console:
GET http://localhost:1337/blog net::ERR_CONNECTION_REFUSED
This is content my /etc/hosts file:
127.0.0.1 localhost
#127.0.0.1 debian
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters</pre>
This is content of my /etc/hostname:
debian
Could someone solve this mystery?
So, I add some things:
/config/env/development.js:
module.exports = {
models: {
connection: 'PeeterMongodbServer',
migrate: 'alter'
}
};
My /config/http.js is just empty, it means as it was when I have sails installed.

Try ifconfig or ipconfig as applicable
FOR e.g inet 192.168.1.64
Also update your etc/hosts file
$ cat /etc/hosts
127.0.0.1 localhost
192.168.1.64 debian
Pls ensure this is tabbed between IP address and hostname.

Related

VirtualBox: How to access virtual host on VM from host?

How to access from the host the Apache virtual domain created on virtual machine.
Settings of the VM on VirtualBox:
VM ubuntu/precise32 on VirtualBox created with vagrantfile from How to setup a LAMP development environment in Vagrant by Sanchit Jain Rasiya
installed Apache/2.2.22
installed Lynx browser
Virtual Host /etc/apache2/sites-available/example.com
ServerAdmin webmaster#example.com
ServerName example.com
DocumentRoot /home/vagrant/www/example.com
AllowOverride All
Order allow,deny
Allow from all
ErrorLog "/home/vagrant/www/example.com/logs/example.com-error.log"
CustomLog "/home/vagrant/www/example.com/logs/example.com-access.log" combined
From the browser on the host machine I can access VM's localhost as http://192.168.205.10/index.html
How can I access VM's example.com?
On the host's /etc/hosts I have added line for example.com
127.0.0.1 localhost
127.0.0.2 tmp.loc
127.0.0.3 temp.loc
192.168.205.10 example.com
When I try http://example.com/mj.html I get the 404 Not Found page from Apache/2.2.22 (Ubuntu) Server at example.com Port 80
On the virtual machine I can access page with the Lynx
lynx http://example.com/mj.html
This is noted in the /home/vagrant/www/example.com/logs/example.com-access.log file as
127.0.0.1 - - [03/Apr/2016:15:53:49 +0000] "GET /mj.html HTTP/1.0" 200 344 "-" "Lynx/2.8.8dev.9 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.12.14"
But when I try to access example.com from the host there are no logs neither in access.log nor /home/vagrant/www/example.com/logs/example.com-error.log
There are no logs in the host's Server files /opt/lampp/logs/access_log and /opt/lampp/logs/error_log
On Ubuntu /etc/hosts:
127.0.0.1 localhost
127.0.2.2 example.com
On Windows (VBox) C:\Windows\System32\drivers\etc\hosts:
10.0.2.2 localhost
10.0.2.2 example.com
Then just reboot your VBox Windows and type in browser (on Windows):
http://example.com/
I have the same issue, I've been trying to access my drupal project from my virtualbox vm but it is not working. One of the solutions I found on the Internet is using the outer keyword in your hosts file in the VM.
The following works fine for me:
In your host machine (let's say a ubuntu) type: ifconfig, and get the
inet address of wlan0 (example: 192.168.1.15)
Add this address to the host file in your virtualobox machine and use the outer keyword
[192.168.1.15 outer]
Now you can access your localhost from your virtualbox browser by typing the address of your wlan0 (ex: 192.168.1.15).
If you need to access a specific port on your host add the port number to
the address example 192.168.1.15:8001

How to access specific port in vagrant box laravel/homestead?

I'm working on a node project on my vagrant laravel/homestead box.
Everything works fine, I can access the project when I go to the host define in my /etc/hosts :
192.168.10.10 project
But, I'm trying to build and watch my project with webpack, so I installed webpack-dev-server and I can run it :
http://localhost:8080/
webpack result is served from /
content is served from /home/vagrant/Workspace/Kanban
404s will fallback to /index.html
[...]
webpack: bundle is now VALID.
My problem is, when I try to access project:8080 with my browser, I get a loading error.
A netstat -an | grep 8080 in the vagrant shows me that the box is listening.
I tried to forward ports using homestead.yaml
ports:
- send: 8080
to: 8080
protocol: tcp
But with or without port forwarding, all I get is an error page.
What can I do to make my webpack watcher work ?
Okay, I finnaly found the answer.
The problem was about not ports but the dev-server. It is configured by default to work only on the localhost. The solution was to add a rule to the configuration :
devServer : {
[...]
, host : '0.0.0.0'
}
Setting the host to '0.0.0.0' allows the dev-server to be accessible from anywhere, therefore, to my "real" host.
I found the explanation on a GitHub issue. Too bad that the arguments list wasn't on the official documentation.

GET /favicon.icon 404 error in ngrok

On running ngrok and going to the suggested url, i get
GET /favicon.icon 404 error in ngrok.
In which folder does ngrok search for the favicon.ico file ?
How do i fix this ?
Very new to ngrok. Do help me out
Thanks in advance
I ran into a similar problem with URIs from ngrok being served as 404s.
I have a local Apache, PHP and MySQL stack setup on macOS using *.dev domains.
So in my case, I needed to set the host-header option in ngrok to match the hostname of the virtual host Apache was configured for.
Here's the relevant part of my Apache virtual host configuration:
<VirtualHost *:80>
ServerName example.dev
ServerAlias www.example.dev
...
UseCanonicalName Off
</VirtualHost>
The necessary ngrok arguments to tunnel requests to my private development domain were:
$ ngrok http example.dev:80 -host-header=example.dev
What ngrok do is,make tunnels to localhost.That allows you tunnel requests from Internet to your local machine.
You can see following details after running : ngrok http 8888
Tunnel Status
online
Version 2.0.19/2.0.19
Web Interface http://127.0.0.1:4040
Forwarding http://299954c1.ngrok.io -> localhost:8888
Now all the data intended for 'http://299954c1.ngrok.io' url which is publically accessible will come to your local machine at port 8888
You need to have some server running on your local machine at port 8888 which can serve 'favicon.icon' static file
If you are able to get icon by hitting : localhost:8888/favicon.icon in your browser, You will surely get it from http://299954c1.ngrok.io/favicon.icon

Apache 2.4 virtual host on different port than 80

When reading the articles it all seems easy, but I am unable to get this to work. I run apache 2.4.7
Several virtual hosts are running just fine. I need one virtual host to run at port 8080 only. So I added Listen 8080 to ports.conf
In the virtualhost conf file:
VirtualHost *:8080>
After a restart I am not getting the virtual host. I do see the default server page and I also notice that the Listen 8080 line is working.
What am I forgetting?

Why does Nginx give a 502 error only for mobile devices?

Using Nginx, I'm getting the error:
Error 502 - Bad Request
The server could not resolve your request for uri: http://domain.name/file/path
Oddly, I only get this error when my phone is using data from my cell carrier. The server serves everything just fine when I am using my phone on Wi-Fi or when I'm using a desktop computer. It even works when I am using my iPad conneted to my phone via Wi-Fi with my phone acting as a mobile hotspot.
The 502 error code suggests that there's an issue with reverse proxying or serving requests with php-fpm. I'm doing neither of these.
Because this error is happening only under specific circumstances, I'm thinking it has to be something with the request my phone is sending. (Nexus 5, Chrome, Android Lollipop)
My nginx.conf and other configuration files are passing tests. I used:
sudo nginx -t
and it said "the configuration file syntax is okay" and "configuration file test is successful."
What could be going on?
After tripple-checking my Nginx configuration, I had the idea to look at all tcp activity on port 80 of my server.
I installed tcpdump:
sudo apt-get install tcpdump
Then ran it, looking only for port 80 tcp traffic:
sudo tcpdump 'tcp port 80' -i eth0
I noticed that all other traffic was just 'IP', but when I sent a request from my phone, it was 'IP6'.
My server wasn't ipv6 enabled, but that's an easy fix with an additional listen directive:
listen [::]:80;

Resources