How can I modify my IP address on my localhost in MAMP? - wordpress

Developing a plugin for WordPress locally I'm wanting to implement Akismet in form validation but I'm required an IP address with the submission and when I run:
function check_ip_address() {
if (isset($_SERVER['REMOTE_ADDR'])) :
$ip_address = $_SERVER['REMOTE_ADDR'];
else :
$ip_address = "undefined";
endif;
return $ip_address;
}
echo check_ip_address();
I get back a ::1. When I researched to resolve this I didn't find a solid answer from:
Ask Different tag MAMP
How do I rename MAMP web server?
When researching how to resolve ::1 I found Should a MAMP return ::1 as IP on localhost? that suggests a sudo of:
sudo vi /etc/apache2/httpd.conf
So I go to MAMP/conf/apache/httpd.conf and try to modify line 48 from Listen 8888 to Listen 127.0.0.1 and I get an error and Apache will not restart. How can I modify my MAMP IP so I can get a proper IP from $_SERVER['HTTP_USER_AGENT']?

It's ::1 because that's the IPv6 loopback address, equivalent of 127.0.0.1, and the remote address is yourself as MAMP is running locally, the remote browser is on the same machine.
REMOTE_ADDR represents the IP the request came from. In most scenarios this is the same as the IP the browsers machine has on the open-internet, but here MAMP is running Apache natively so it's 127.0.0.1 or ::1. If you were using a docker container or a Virtual machine, it would be a private IP on a range specified when configuring your containers/VMs.
So to retrieve the IP you're expecting, you'll need to use an external service, or, for the sake of debugging, pass Akismet a hardcoded IP, but I suspect it's asking for the IP of whomever is commenting.

Related

Ping returns from old host IP

I replaced my modem, and in the process of doing so all my device IP's were changed. As a result, I changed all the port forwarding settings, and edited the /etc/hosts file in my ubuntu webserver. As soon as I edited the hosts file to change the IP's to the new ones, the server lost internet connectivity. When I try to ping an internet destination, say 8.8.8.8, it returns this
From 10.0.0.XX icmp_seq=10 Destination Host Unreachable
Only problem is, that IP is the old one. I double checked /etc/hosts, but they're all updated. How can I fix this?
Thanks!
solved by running these commands on the local machine, NOT SSH
sudo dhclient
sudo dhclient -r
sudo dhclient

neo4 WebSocket connection to 'ws://localhost:7687/' failed: Establishing a tunnel via proxy server failed

I have neo4j community server edition 3.4.5 and which will be giving me "WebSocket connection to 'ws://localhost:7687/' failed".
I found some solution to work in firefox, chrome, IE but those are temporary solutions which work. but I don't think that just by passing proxy would be a permanent solution.
It is not working if connected to VPN(office network), otherwise working. What could be a reason for this error within an office network? How to resolve this issue.
Any idea or suggestions, Please
There can be several reasons for this issue and I probably need to know more about your setup before I can pin point the problem.
1 check:
Disconnect from the VPN, and open a command prompt (Windows+R then write cmd and press enter)
Use either telnet or putty ( https://www.putty.org/ ) and connect to 127.0.0.1 port 7687:
telnet 127.0.0.1 7687
See if you a response like this:
GET / HTTP/1.0
2 check:
Go to you proxy settings and see if you have a proxy enabled:
Firefox: Preferences/Options > Advanced > Network > Settings
IE: Tools > Options > Connections > Lan Settings
Suggest to turn off your proxy and do the check in check 1 again.
3 check:
Connect to your VPN and do the check 1 part once again
Check for error messages (that you probably would get) and then write in the command prompt:
route print
It should show a line like this:
127.0.0.0 255.0.0.0 On-link 127.0.0.1 xxx
127.0.0.1 255.255.255.255 On-link 127.0.0.1 xxx
127.255.255.255 255.255.255.255 On-link 127.0.0.1 xxx
This ensure that you still have your loop back up and running (probably is ok).
4 check:
Turn off your local firewall with VPN connected (if allowed) and try the check 1 again.
Some firewall rules change connections to "localhost" while connected to a VPN, since the new connection is "corporate" or "public".
If that worked, you need to create a rule in your firewall to allow connection to port 7687 for all addresses, this will fix your problem.
5 check:
Check your neo4j community server to listen to "127.0.0.1" and not "0.0.0.0"
Check your ports open by using netstat
netstat -a -o
It should state something like this
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:7687 machinename:0 LISTENING xxxx
or
TCP 127.0.0.1:7687 machinename:0 LISTENING xxxx
If the server is like the first line, it might be handled by a corporate firewall, but by using the 127.0.0.1 as address it should always be local.
Hopefully that will get you on the way :)
i had same problem, so Let me tell you what i came out with...
the company has a proxy server for all connections, so i change my request from IP to DNS by typing nslookup IP on command prompt terminal.
from: ws://180......:80/socket/test to: ws://mxjuppro22......:80/socket/test
then error gone and now is working like a charm!!!
hope it helps

How to bind Kibana to multiple host names / IPs

Is there a way to bind Kibana to more than one IP address using kibana's config file: kibana.yml?
Right now, if I modify the line
server.host: "127.0.0.1"
to
server.host: ["127.0.0.1","123.45.67.89"]
which is valid YML, I get an error.
Is there any way to accomplish this from within Kibana or do I need to do it through a proxy/nginx?
Try 0.0.0.0 if you want kibana to be available on real ip and localhost at the same time.
Install ngrok from https://ngrok.com/, then from your command line type:
ngrok http 5601
Ngrok will create a tunnel to the server and provide you with a url from which you can access your kibana UI.
If you need to acceess the ngrok and the 4040 port is closed on the server then do the same
ngrok http 4040

How to do port forward on a VPS?

I have a VPS on Ubuntu 13.10 x86_64 it has an:
public IP: say 1.1.1.1
private IP: 198.168.1.33
and I want to redirect all my incoming traffic to port 443 to my private IP 198.168.1.33
I have only SSH access to the server, can anyone tell me the command to do it? Thx.
The easiest way would be to use Apache and either
Setup a virtual host - see Examples
OR
Use Apache Proxy

how to configure gateway on centos(used google but no answers)

here are some configuration files from the virtualbox on centos5.5, i've restart the network,but also can't connect to the internet, no gateway records information listed using route command, however,while i typing "route add default gw 192.168.0.1" and it works well.how shoud i configurate the gateway ip? thanks in advance.
/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
/etc/sysconfig/network
GATEWAY=192.169.0.1
NETWORKING=yes
HOSTNAME=localhost
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="00:24:1D:8A:3D:F7"
ONBOOT="yes"
BOOTPROTO="static"
BROADCAST="192.168.0.255"
NETWORY="192.168.0.1"
IPADDR="192.168.0.109"
NETMASK="255.255.0.0"
CentOS 5 should have file route-eth0 (in /etc/sysconfig/network-scripts )
put this string into it:
default X.X.X.X dev interface
make sure you change X.X.X.X and interface to your.
Btw, take a look to http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s1-networkscripts-static-routes.html

Resources