Avoid http redirection on Apache installed on raspberry pi - apache

I want to setup a website on my raspberry pi 3 (with raspbian) to be accessible from the internet.
I installed Apache webserver (v 2.4) and Word Press, and I can connect to the website from the LAN.
To have my website accessible from the internet, I configured my router to perform forwarding of port 80 to a static IP given to the raspberry pi.
However, when i try to access the website from the internet (using the public IP 213.57.x.x), the browser is automatically redirected to the internal IP (192.x.x.x).
For me it looks like the default Apache settings (which i didn't change) perform IP forwarding.
I suspect that the Apache is the problem because I do not encounter the same problem on tomcat installed on the machine (so the router configuration is OK).

Related

Connect to local apache server via site domain

I'm locally running an apache web server using Centos (CentOS Linux release 7.9.2009). I used to be able to connect to this local server using a subdomain of mine "demo.mywebsite.com" by adding an A record pointing to my main IP address and forwarding the 80 port on my router to my server local IP.
This morning my router updated and reset by itself, and surprisingly I found out that the port 80 is no longer available for port forwarding since "it is used by the router interface". So now I can't access my server website using demo.mywebsite.com/foldername
I'm wondering if there's a way to access my server even without the ability to forwarding the 80 port.

Raspberry pi web server from internet

I have been trying to make an access to my Apache server on Raspberry Pi from internet for several days.
I set up Apache, PHP, mySQL, myadmin and put index.php to 'www' folder
I edited dhcpcd.conf to set static IP.
interface eth0
static ip_address=192.168.1.220/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
I registered mydomainname.net on no-ip.net for my internal IP address
Installed No-IP Dynamic Update Client on raspberry pi and it's status is active
I opened port 80 on my router for static IP Address of my RASPBERRY (192.168.1.220)
On my router I added my no-ip account and it shows status 'Success'
I even tried to change Apache listened port from 80 to 8090
But, whatever I do, I can't get access to mydomainname.net from internet, but I can do it from my local network on my static Raspberry IP - 192.168.1.220.
So the problem is the IP you are using is your internal IP. This IP is inaccessible from the outside. As long as you are inside your network you can use the internal IP adress tho.
try using https://www.canyouseeme.org/ to obtain your router IP adress maybe then you'll be able to acces it trough IP already. also this is the IP that you need to register on the host of your site.

RaspberryPi as hotspot without internet accessed via a domain name

I have a RPi set up as a hotspot (hostapd) that I use to access a web server set up on the RPi.
This RPi is not connected to the internet, it's just to serve some local pages.
I have Apache installed and so I can easily access it via a browser with the address http://192.168.42.1
The question is how can I use a domain to access it instead?
say I want to connect to the WiFi of the RPi (losing my internet connection) then on my browser go to http://example.com and load/redirect me to http://192.168.42.1 instead.
You can add a hosts entry in the device from which you want to access your raspberry pi using a domain.
Let us assume your Pi's IP is 192.168.1.69
assuming the domain you want to use is local-pi.com
Example: In an ubuntu based system:
add the following lint to your /etc/hosts file:
192.168.1.69 local-pi.com
In a windows based system add the following line to your C:\Windows\System32\Drivers\etc\hosts file:
192.168.1.69 local-pi.com
In the apache server configuration of your pi add the following line:
ServerAlias local-pi.com

cannot access my webpage from outside (xampp)

I am trying to set up a web server with Xampp (ver 7.0.13) on my home PC. I redirect port 80 from router to my PC and Xampp is listening to port 80. Also, I change router's web server's port to 8080 in order to avoid conflict.
Result: I can access my helloworld.html on my pc and my phone. However, If i turn off my iphone wi-fi and using 4G network, I will not able to access dashboard and my helloworld.html by public ip (56.XXX.XXX.XXX/helloworld.html)
I try :
reinstall xampp
try different version off xampp
change config file >> Order deny,allow from all (something like that
try to change but cannot be found in most of the config files.
change router port forward setting.
But nothing work. What did I do wrong? ┐(´д`)┌
Maybe external traffic is blocked by the Windows-Firewall?
Is it a static IP? You should use a static IP in your server, if not, is impossible

show my localhost in someother pc via ip

I have a site in my local which is running under xampp.Now in another Mac I want to access the local site.It can be done via sharing the ip? or something to write in host file.The source machine is windows and the target machine is mac.
I dont know how to include the ip in host file in Mac.
Assuming that it's running on port 80 or 443 and your firewall is set to allow requests on those ports, you should be able to navigate to the ip address in a browser. If you're requesting your local site from outside your subnet then you might need to configure port forwarding on your router