Using "http://localhost" instead of "http://xx.xx.xx.xx" on iPod on WAMP - iphone

I am running Windows 7 and use my iPod Touch to access my localhost sites for testing purposes on WAMP.
I can browse my localhost sites by navigating to my machine IP in Safari on my iPod like so: http://10.0.0.100
I would like to know if it is at all possible to use http://localhost instead, and how I can accomplish that.
Thank you very much!!

Basically, localhost refers to 127.0.0.1 refers to the loop back ip which is the ipod itself so it's not possible unless you change [localhost to resolve to machine IP which is in this case 10.0.0.100] in the (DNS / hosts file) your ipod is using to resolve domain names in your connection settings and I don't recommend that.
Following are the steps needed to change the hosts file in your ipod (I warned you already this is not a good thing unless you know what are you doing)
source: https://discussions.apple.com/thread/2801892?start=0&tstart=0
Simple solution:
the hostfile is located at: /etc/hosts
To edit this file you need to SSH into your device, If you know how to do this directly just use vi, or nano to edit the file. From windows use WinSCP to access the file system via FTP(SSH). Then simply navigate to /etc/hosts download the file to your desktop, right click and open it with note pad, add your resolver to the last line "192.168.0.100 testserver", save, and replace the original file with the new one.
/etc/host -- example config
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
192.168.0.100 testserver
*To SSH into an ipod it must have OpenSSH installed, usually this requires a jailbreak.

Related

How to start wiremock standalone with custom hostname?

For example, I want to start wiremock standalone with hostname "my.abc.com" with port 9999. Where can I config that? Or what is the right command line options for hostname?
Thanks a lot in advance.
The hostname is determined by DNS or your host file, rather than WireMock itself.
If you want to run everything locally but with a hostname other than localhost you can edit your hosts file and add a line like:
127.0.0.1 api.mydomain.com
Then you can hit a locally running WireMock server on e.g. http://api.mydomain.com:9999/
As agoff points out, if you want to use the Java DSL against the instance you need to configure it:
WireMock.configureFor("api.mydomain.com", 9999);
The host file can be found in the following places:
Windows - c:\Windows\System32\Drivers\etc\hosts
Mac - /private/etc/hosts
*nix - /etc/hosts

can ping 8.8.8.8 but not google.com

I just got a new router and internet connection.
My phone and my second computer have no problem to connect to internet (wifi or cable). My first computer, where I am running Limux Mint 18.1 Serena, can connect with cable or wifi but I am unable to browser.
I can ping 8.8.8.8 but not google.com.
I do not understand much of DNS but I tried to follow some online tutorials.
I tried to modify the /etc/resolconf directory by adding a resolv.conf file with a new servername but didn't work (even after restarting network-manager). I tried as well to modify the /etc/resolv.conf.d/tail file (as read in other tutorials) by adding a new servername but still not working.
Any suggestion?
Your DNS resolving doesn't work.
Check your firewall for an open port UDP/53 to 8.8.8.8
# iptables -L -n -v
Check with your ISP for DNS server provided. They are probably blocking UDP/53 somewhere on the way out to force you to use internal DNS server.
If you are on DHCP, renew the lease.
Depends on distro (most probably networkmanager, ifdown/ifup combination may work as well). This happens quite often with resolvconfd and dnsmasq. You may need to restart the NetworkManager then
Again - command depends on distro, usually with systemd
# systemctl restart NetworkManager
If you are on static IP and have noone to ask or check their config, you may sniff (tcpdump -nnvv -i <interface> udp port 53).
The problem occurs due to trouble with DNS setting
If you are using linux follow:
Clear this file content (root permission required)
nano /etc/resolv.conf
Add the folling text:
nameserver 1.1.1.1
nameserver 8.8.8.8
Save and Reboot
If using Windows Follow:
Control Panel\Network and Internet\Network and Sharing Center
Select current active connection (wifi/broadband)
Properties > Networking > ipv4 > custom dns > 1.1.1.1 & 8.8.8.8
check Validate setting upon exit > save

Padrino development host

How can I specify a default host and port for Padrino?
Normally I could start my process like this:
padrino start -h myhost
I want to change the default parameters of start. I expected that to be done by editing the config/apps.rb to:
Padrino.mount('MyApp::App', :app_file => Padrino.root('app/app.rb')).to('/').host('myhost')
However with the above line, Rackup still starts listening only on 'localhost'. So I assume that the host() option does not have an effect on Rack at all.
Ideally I would like to set the port/host just for "development" mode, but I cannot find the place where that setting is handed down to the rackup/webrick server.
These options are now defaulted to 127.0.0.1 for security and paranoid reasons.
To rackup here: https://github.com/rack/rack/blob/28b014484a8ac0bbb388e7eaeeef159598ec64fc/lib/rack/server.rb#L187
To padrino s here https://github.com/padrino/padrino-framework/blob/5fe35ccbd2ffbf78d78233e9a47759eff1c6cc92/padrino-core/lib/padrino-core/cli/base.rb#L16
Considering your desire to host development mode app on local Ethernet, you have a dedicated server and you should have no problem setting up something like Passenger to host your app.
BTW, version 1.5.2 of rack still hosts the config.ru on 0.0.0.0, if you are locked on this version you can use rackup to host your development app for local network.

Google App Engine Java on Eclipse can not connect to localhost

Usage: [options]
Options:
--help, -h Show this help message and exit.
--server=SERVER The server to use to determine the latest
-s SERVER SDK version.
--address=ADDRESS The address of the interface on the local machine
-a ADDRESS to bind to (or 0.0.0.0 for all interfaces).
--port=PORT The port number to bind to on the local machine.
-p PORT
--sdk_root=DIR Overrides where the SDK is located.
--disable_update_check Disable the check for newer SDK versions.
--generated_dir=DIR Set the directory where generated files are created.
--jvm_flag=FLAG Pass FLAG as a JVM argument. May be repeated to
supply multiple flags.
I had come across similar problem while working with Google App Engine for Python-loalhost was not getting its connection established.
$fuser -k 8080/tcp
Try this in terminal/command prompt and restart localhost.
It worked for me. Hope it works for you also. Good luck!

Postgres.app configuration (port and other options)

I just installed Postgres.app on my Mac, and I need to make some specific configuration to server. For example I want to use different port, not 5432.
I found that it have postgresql.conf at ~/Library/Application\ Support/Postgres/var/postgresql.conf, but even if I change value of port = to something other, it listen on 5432 after server restart.
Seems that this postgresql.conf isn't used by Postgress.app. Where it stores server configuration files?
The postgresql.conf-file at ~/Library/Application\ Support/Postgres/var/ is used by Postgres.app. The only problem: if you change the port in that file, that change will not be reflected in the menu-bar. So the elephant over there will still say "Running on Port 5432", although postgres might be running on, for example, port 5433. (Mac OS X 10.8.2, Server.app 2.2, Postgres.app 9.2.2.0)
I can see the output from ps aux |grep post
/Applications/Postgres.app/Contents/MacOS/bin/postgres -D /Users/chenc26/Library/Application Support/Postgres/var -p5432
So I think there must be some config in this app to specify the CLI parameter which ignore the value from config file.
I'm running a Mavericks 10.9.3 and opening Postgres app v9.3 config via nano ~/Library/Application\ Support/Postgres/var-9.3/postgresql.conf and uncommenting the port = 5432 line, then changing it to, say, 5433 did the trick for me. (Restarting the app was required, as the config file mentions). Afterwards the app correctly displays that it is running on port 5433.
If correctly changing the content of postgresql.conf, then restarting the PostgreSQL server doesn't change the port it's listening on, you're almost certainly editing the wrong postgresql.conf.
On other platforms, PostgreSQL puts a copy of its default version of postgresql.conf in the data directory. So you're liable to find at least two copies of all the configuration files somewhere on your computer--usually one in the directory where the distribution or source was downloaded or uncompressed, and one in the data directory. On your Mac, if you're using version 9.1, the data directory might be
/Library/PostgreSQL/9.1/data/
Check for a postgresql.conf there. If you find one, consider making a copy of it to replace the one you edited. (So the one you edited will again be an unedited version.)
In 2022, I can't just edit the server.conf file. It looks like instead, I've had to do this from the GUI to change the port which the command line parameters refer to:
... bin/postgres -D /Users/MyUser/Library/Application Support/Postgres/var-11 -p 6543
The way I was able to make the change was to:
Open the Postgres elephant icon in the top bar.
Select "Open Postgres"
Stop the server.
Click on server settings.
Then, change the port in the simple input.
After this, start the server and find that the port has changed.
This works for the Postgres.app (version 11 on my desktop).