How do I change the IP address in XAMPP for Windows? - xampp

I've been trying to figure out how I can change my server config for XAMPP so that it doesn't have a memory fault when both Windows and the server are trying to access localhost at the same time. Basically I want XAMPP to be IP of 127.0.1.1 or something similar so it doesn't interfere with the localhost used by the system so I can browse the web and my websites that I'm developing. What is happening is that if I have XAMPP and Eversoft's first page 2000 v2.0 running at the same time, I'll get a BSOD (blue screen of death) in the middle of editing my sites. This is an intermittent problem, but always happens with these two programs.

Just edit c:\xampp\apache\conf\httpd.conf and change the Listen 80 to Listen 127.0.0.2:80 or whatever ip address you want. Make sure you place : between the ip address and port number, in this case it was port 80.

These are the steps to follow when you want your PHP application to be installed on a LAN server (not on web)
Get the internal IP or Static IP of the server (Ex: 192.168.1.193)
Open XAMPP>apache>conf>httpd.conf file in notepad
Search for Listen 80
Above line would read like- #Listen 0.0.0.0:80 / 12.34.56.78:80
Change the IP address and replace it with the static IP
Save the httpd.conf file ensuring that the server is pointed to #Listen 192.168.1.193:80
In the application root config.php (db connection) replace localhost with IP address of the server
Note: If firewall is installed, ensure that you add the http port 80 and 8080 to exceptions and allow to listen. Go to Control Panel>Windows Firewall>Allow a program to communicate through windows firewall>Add another program Name: http Port: 80 Add one more as http - 8080
If IIS (Microsoft .Net Application Internet Information Server) is installed with any Microsoft .Net application already on server, then it would have already occupied 80 port. In that case change the #Listen 192.168.1.193:80 to #Listen 192.168.1.193:8080

Hint:
first part=file location --- second part=find in the file ---
third part=replace with finded text
How Change "127.0.0.1" in Xampp To "127.0.0.2" (or paste your favorite ip instead 127.0.0.2)
(C:\xampp\apache\conf\httpd.conf) --- Listen 80 --- Listen 127.0.0.2:80
(C:\xampp\apache\conf\extra\httpd-ssl.conf) --- Listen 443 --- Listen 127.0.0.2:443
(C:\xampp\php\php.ini) --- ;xdebug.remote_host = "127.0.0.1" --- ;xdebug.remote_host = "127.0.0.2"
(C:\xampp\phpMyAdmin\config.inc.php) --- $cfg['Servers'][$i]['host'] = '127.0.0.1'; --- $cfg['Servers'][$i]['host'] = '127.0.0.2';
How Change "Localhost" in Xampp To "myhost" (or paste your favorite name instead myhost)
xampp control panel admin butoons still open localhost
(C:\xampp\apache\conf\httpd.conf) --- ServerName localhost:80 --- ServerName myhost:80
(C:\xampp\php\php.ini) --- ; SMTP = localhost --- ; SMTP = myhost
(C:\Windows\System32\drivers\etc\HOSTS) --- 127.0.0.1 localhost --- 127.0.0.2 localhost
127.0.0.2 myhost >>> #(next line after 127.0.0.2 localhost)

You can point 127.0.1.1 to 127.0.0.1 in your windows hosts file (Windows/system32/driver/etc)

Related

How to set up virtual hosts when changed the default port(80) to 8080?

I'm using MAMP on windows 10 and I couldn't start Apache server because of my default port(80) is used by System. So I changed the default port to 8080. But now I can't access my previously set up virtual host sites. Please help me
I already tried this :
1) MAMP\bin\apache\conf\httpd.conf
Listen 8080
2) MAMP\bin\apache\conf\extra\httpd-ssl.conf
<VirtualHost _default_:8080>
Listen 8080
3)hosts file
127.0.0.1:8080 mygym.test
4) MAMP\bin\apache\conf\extra\httpd-vhosts.conf
NameVirtualHost *:8080
<VirtualHost *:8080>
DocumentRoot "E:/MAMP/htdocs/mygym/system"
ServerName mygym.test
</VirtualHost>
now when I typed as mygym.test in the URL tab It comes a 404 error
No webpage was found for the web address: http://mygym.test/
You are doing it wrong.
3)hosts file
127.0.0.1:8080 mygym.test
The hosts file is for host name resolution only. You cannot put port numbers in there. the browser is what selects the port to choose.
Instead try 127.0.0.1 mygym.test in hosts file and try http://mygym.test:8080 in browser.

MacOS doesn't resolve localhost to 127.0.0.1 (ignores hosts / apache vhosts)

I ran into the problem, that localhost redirects to a specific domain instead of 127.0.0.1.
My configuration is a local apache/mysql/php installation on MacOS Mojave using vhosts for different projects that are configured in hosts to redirect properly.
When I enter 127.0.0.1 in any browser, I get to my overview page lying in the www root. The same should happen, when I enter localhost in the browser, but instead it redirects to a domain of a project I was working on in the past. It happens also without network connection, so the configuration is on this machine.
My /etc/hosts file:
##
# 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 project1.local project2.local
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
The first line seems to be ignored and localhost doesn't resolve to 127.0.0.1.
I only have two vhost configurations plus default configuration with no wrong redirection and also the httpd.conf lookes fine. I searched the whole machine with grep -lr "redirectiondomain.com" * without results. I tried with apache switched off with the same result and looked up the MacOS network settings but I can't find anything related to the wrong redirection neither any other solution on stackoverflow or google that solves my issue. Has anybody a clue how the wrong redirection of localhost could be set somewhere else?
Edit: My hostname in MacOS is set. I tried localhost without port, with :80 and :8080

Play Application runs on port 443 but nothing resolves from a browser

We have a Play application running on a Linux box that resolves to port 443 instead of port 80 or port 9000.
The application is up and running without errors - there are no errors in the SSH console.
Port 80 is disabled (HTTP) but we want to have the web application appear in the browser using port 443 (HTTPS).
We have the application.conf file set up to use the correct port as well as the correct keystore path and keystore type (JKS).
Since there are no errors, we would like to know what we can do to correct this situation. Any help would be great!

Can't access 127.0.0.1 apache 2 (MacOS X)

After my MacBook Pro mid2009 has been updated to MacOS X El Capitan I found that many things don't work anymore as they were before.
Built-in apache2 is not aviable on http://127.0.0.1 but aviable on http://localhost. In Yosemite both of them was working properly.
/private/etc/hosts looks like that:
##
# 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
It's looks strange cuz 127.0.0.1 and localhost are the same thing.
Any idea what's going on?
httpd.conf
#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80
In your httpd.conf, you will have a Listen directive, this will be the ip address / port that the server will bind to.
In your conf file you have defined
Listen 80
That is stating that you should bind to all interfaces on port 80, this will include both IPv4, and IPv6;
Disabling IPv6 should would, change this line to
# allow access on all interfaces
Listen 0.0.0.0:80
# or for local access only
# Listen 127.0.0.1:80
# or more specifically
# Listen 192.168.0.0:80
# To listen on a specific subnet
To figure out why the site will not load when accessed via IPv6, would require additional error / debug logs.

Modify destination port in TCP/IP headers of all outgoing packets

Used SSH Tunnel to route the traffic addressed to server1:port1 to server2:port2.
Now,the problem is that i want to redirect all TCP/IP packets from desktop addressed to server1:port1 to server2:port2.
using "hosts" file on windows, i mapped server1 ip as ipaddress of server2. [local DNS mapping]
http://server2:port2 //gives the desired page.
http://server1:port2 //gives the desired page as server1 ip is mapped as that of server2 ip.
Is it possible to rewrite the destination port of all TCP/IP packets addressed to some host?
[Transform destination port all TCP/IP packets with (destn ip as server1 and destn port as port1) to port2]
This is required as there is no direct access to server1 from the working desktop.
I can't use the same port number on server2 as that of server1 as that port is already taken on server2.
Please share your comments on this.
You can use iptables to rewrite the destination port either on the desktop machine or on an intermediate router.

Resources