apache2 web server works on localhost but can't go live - webserver

My website cannot go live!
The following is my web server setup.
1. Rogers modem – Hitron CODA-4582
2. Port Forwarding
Application Name Public Private Protocol Local IP Address
HTTP 80 – 80 800 – 800 TCP 192.168.0.201
HTTPS 443 – 443 883 – 883 TCP 192.168.0.201
3. Operating System - ubuntu 16.0.4
Apache2 Sever /etc/apache2.conf file.
I modified two things.
a. Uncommented the line ServerRoot “/etc/apache2”
b. Appended one line at the end of the file: ServerName my_rogers_IP_address.
I executed a command: sudo app info “Apache Full”
The output is
Profile: Apache Full
Title: Web Server (HTTP,HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.
Ports:
80,443/tcp
Then, I executed another command: sudo ufw allow in “Apache Full”
I thought I have done what I needed to do. So, I opened up the browser for testing. It only works for 127.0.0.1 or localhost. It won’t work if I enter http://my_rogers_IP_address.
Can someone give me a pointer?
Thank you in advance!

You need to point the apacheserver to a host that can actually host your website. Localhost is just a local loop between your computer's machine and the server. I would recommend using Heroku, or Cloud9, which is free. Additionally, you could buy a static IP for your site to use, however, this is not cost-effective. It is up to you whether you have the funds or just want to do this for fun.

I got my problem solved!!
It is my bad! Everything is fine except the private port setting.
The private port must be within the public port range.
Everything is working fine now. Hope this can help someone else.
Good day!

Related

Expose Ngrok Web interface in same LAN

I have some issue to configurate Ngrok.
I have installed the Ngrok on linux CentOS server dedicated (IP 192.168.1.124), it works correctly the tunneling is ok.
My question is: how i can reach the web page on 127.0.0.1:4040 in order to check the traffic on my Ngrok server?
The web interface page is only accessible on the server where ngrok is running, but if this is a linux minimal server (without gui and any type of browser) I can't see it.
is there a way to make it accessible also in LAN?
e.g. I have another client that can reach the IP where ngrok is running but if i put on web browser http:\192.168.1.124:4040 nothing is showing.
I see from netstat that this port is not listening so isn't a firewall problem or other.
Is possible to change config of Ngrok? otherwise are there other possibilities ? do i have to use a reverse proxy or something like?
Any ideas?
thanks for your help,
Luca
Locate your ngrok's config file:
$ ngrok config check
Valid configuration file at /home/youruser/.config/ngrok/ngrok.yml
Add to the config file the following line:
web_addr: 192.168.1.124:4040
In case you want to expose it to all interfaces, you can replace that value with 0.0.0.0:4040

Server Connection with public IP

I have setup a simple HTTP java server running locally on port 8000. It simply prints a message "Hello world" when a request comes. When I try to ping it from the browser by running http://localhost:8000/test I get my message printed.
I want to get the same results from another computer that is not local. When I try to use my public IP lets say http:/43.xxx.xxx.xxx:8000/test (even from the same machine) I get an ERR_CONNECTION_REFUSED .
I probably suspect that has something to do with the firewall. Can anyone guide me a little more because I lack the experience?
Thanks in advance
You don't specify what host OS your server/firewall is running so I'll keep this generic...
Without knowing your application, it seems like the server is sending a reset (RST packet) when the first SYN packet shows up indicating that the port (on that interface [your external]) is closed. You can do a quick port scan from here (https://mxtoolbox.com/PortScan.aspx) if you don't have access to a remote machine to test with. Odds are, TCP/8000 will not be open.
If it is, in fact, closed, you'll have to look at the firewall that your host OS is running and find out how to allow TCP/8000 to your host. In a major firewall vendor, your rule would look similar to this:
Source: Any
Destination: Your Public IP Address
Service: TCP/8000
Action: Allow
Logging: Full
That being said, you mentioned this was a PC so look into "iptables" (if you're running *nix) or the Windows Firewall (if you're running Windows) on adding firewall rules (Unfortunately I just joined and can't ask questions/comments, yet).
If you really want to find out what packet is being sent, run a tcpdump on your external interface (let's say eth1) (assuming your remote IP is 1.2.3.4 and your home public IP is 4.5.6.7):
tcpdump -nn -vvv -e -s 0 -X -c 100 -i eth1 host 1.2.3.4 and host
4.5.6.7 and port 8000
Here you're looking for the SYN/SYN-ACK/ACK for a successful TCP negotiation or SYN/RST if there is a firewall rejecting (not dropping) the TCP stream to the port.
Once the port is open on the host OS firewall, take a look at the application to make sure it's configured properly. If this were a standard webserver, you could take a look at the configuration files for the "Allow from" directives to make sure that everyone can access the site. If this is a custom application that you've created, you'll have to check this yourself.
I finally solved my problem. I needed to open a forwarding port in my router that maps my local ip address to the public. My router is TP Link so this what I did:
http://www.tp-link.com/us/faq-72.html
Also in order for this to work every time and not to have to reconfigure this every time I reconected to the router (because I get a new local IP), I have created a static local ip for my server following this guide:
http://www.tp-link.com/us/faq-182.html
Thanks for all the replies.

How to make my XAMPP server public on the internet?

I am trying to make my XAMPP server public on the internet. But when i try to access it using my ip adress it says connection refuzed. I have followed lots of tutorials but most of them are for older versions. I have set the 80,443 ports on and have added them as a firewall exception but it still not working. Can you please give me some sugestions?
The idea is the same no matter the version of XAMPP you are using.
It's not clear if you configured port forward on your router (all connections on ports 80 or 443 will be forwarded to the XAMPP "server"). You should do this orderwise the incoming connection will never be redirected properly.
I am not sure if ISPs can block external access to ports 80 or 443, but you can also configure an alternative port, like 8000, to be forwarded to 80 internally, then you access your server using http://[your_public_IP]:8000
There are some sites you can use to check your public IP, like: http://whatismyipaddress.com/.

Keep port in url when usung redirect in Zend Framework

I have a Windows development machine with an Ubuntu VM set up via vagrant. The VM has Nginx running on port 80 and the Vagrant configuration maps port 8080 on the host Windows machine to port 80 on the VM. For various reasons the project that I'm working uses 127.0.0.1 instead of localhost so, in my browser on the Windows machine, I hit a URL such as:
http://127.0.0.1:8080/foo/bar/baz
The application on the VM is built with Zend Framework 1.12.
If I click a link that has an href="/foo/bar/baz" then all is fine and I go to:
http://127.0.0.1:8080/foo/bar/baz
However, if in one of my controllers I use a redirect to "/foo/bar/baz" then the browser loads:
http://127.0.0.1/foo/bar/baz - i.e without the port in it.
If I then manually edit the URL in the browser's address bar to add the port and hit enter then the page comes up correctly.
I've tried various ways of doing the redirect programatically in ZF, and even tried typing a hard coded URL into the code, but whatever I do it always strips out the port component when the redirect takes place.
Any ideas/suggestions as to how to keep the port in the redirect would be much appreciated.

SSL port 443 conflict, how to make iis7.5 not think another process is running?

I am running a asp.net mvc2 application on iis7.5 using a SSL certificate for port 443.
but as soon as I add port 443 to the Bindings (on "Site Bindings") it wont browse to the site through the HTTPS scheme complainng of another process working.
I have tried renaming port 80 to 8080 to no avail.
Hope someone can help.
All the best
Paul
*Please note this addition it may save time for you:
ADDED NOTE: THE ANSWER TO THIS WAS TO TURN OFF SKYPE AS IT HAD CONTROL OF PORT 443
It kinda sounds like you already have a site using port 443. SSL can't run on a shared IP; the certificate needs to be verified even before the server knows which site's cert to use.
Make sure other sites (especially the default one) aren't bound to the site's address and port.