Installing Apache and port 80 - apache

I have installed Apache 2.2 (and PHP/MySQL) on my personal computer so I can run PHP scripts without needing to upload them every time to my server for testing.
The Apache is working on port 80, i.e. I can view my script by going to http://127.0.0.1:80/index.php .
My question is if there is any danger by using the Apache that way, in the sense that now port 80 is listening. Can anyone use this situation to attack my computer?
Thanks,
Joel

Only if it's bound to external addresses (usually any other than 127.0.0.1). Check the Listen directive in the configuration.

You're probably behind a router which blocks access to your computer.
So, no one can attack your computer using port 80 : Even if the port would be accessible from the internet, apache is a really sure software, if you don't run sensible code on it, you don't have to fear that some exploit a leak on it.

You should keep your firewall on so that people from the "outside world" can't connect to port 80 and see your files. That is the safest way of protecting yourself.
You can also block non-local traffic in you apache config file.

You could use this apache config option to make sure no-one else can connect to your server:
Listen 127.0.0.1:80
(You should already have a Listen 80 defined)

The best way is to have a good fire wall. Even though your router has a fire wall. Still you won't be 100% safe because even the White House computers got hacked once and same with Sony!
HUGE COMPANIES WITH EXPENSIVE FIREWALLS!!!!!
But IIS forbids acces to upper directories. Microsoft patched it so visitors can even get out of the SUBDOMAIN FILE IN THE WWWROOT FOLDER.
EX: WWWROOT/Subdomain/
^^^ == NO EXIT

Related

Localhost works, but ip gives timout

I am trying to setup a LAMP environment on my laptop with Ubuntu 18.04.
I have no experience real previous experience with this and all tutorials i find are just a step for step guide on how to setup, but none explain what you are exactly doing.
So I don't know why I am having this problem.
After installing all parts of LAMP I can access localhost, and I see the apache default page.
But if I try to go to my IPaddress, (the ipaddress I found with curl -4 icanhazip.com) the page loads for a while and then tells me this:
Firefox can’t establish a connection to the server at 213.127.26.xxx
So my question is am I using the right IPaddress and how can I make apache work from my IPaddress? Because phpmyadmin will not work on localhost.
The issue is likely that your local ports (i imagine your web server is running on port 80 or 8080) are not being forwarded through your router. Your router likely uses something called “NAT (network address translation)” to expose all of the internal IP addresses on your network through a single “public” IP address, in your case 213.x.x.x (you should never post this here unless you’re 100% positive your network is secure!). Your router needs to be configured to forward port 80 on 213.x.x.x to your machine’s “internal” ip address, likely something like “192.168.x.x” or “10.0.x.x”. A search for “port forwarding ” should help you out
Alternatively, ngrok is a nice free tool which you can use to expose your port on a public address. By running nginx http 80, it will provide you with a temporary url where you can reach your site (on a free plan, it will only provide you that url for one day, so you will need to re-run it)
First, you have to find out on which ports your server is running.
After that, you have to go into your router's settings and add port forwarding entries for these ports, to make sure that your router forwards the requests to the right device.

Port 80 is blocked by 'System'

I'm trying to run a portable Xampp webserver to work on a website, but I noticed that on my main computer (other computers haven't had this issue, but I can't use them much and I want to fix this problem instead of avoiding it so it's gone next time) Apache won't run, so I did a portcheck and port 80 is used by 'system'. I included a screenshot, as you can see everything else is free but port 80 is being used.
So, does anyone have any ideas how I can fix this? Finding a way to open port 80 or how to change Apache http to another port are both options, but I don't know enough about apache to trust myself not to completely screw it up and I don't know how to clear port 80.
There are a few similar questions I've found, links here, here & here but none of them give me the answers I need.
Your system might have IIS service. which uses 80 port. you need to stop that service. try following command in cmd as administrator:
iisreset /stop
If you are using skype.. u should check its connections settings and remove the port 80 from it.
On my side, I had to stop "Windows Sync Share" service on windows server 2012. Then I could use the port 80 and use Apache Tomcat 8.

How do I force users to access my Play application through SSL?

I have a Play application that I've deployed by running stage within SBT, and then running it from the command line using target/start. I've placed Nginx in front of it and, based on a sub-domain, I have two server blocks--one for port 80, and the other for port 443. The port 80 block just redirects to the https scheme on port 443. This all works great.
To recap:
http://play.mydomain.com/ redirects to
https://play.mydomain.com/ which is a proxy for http://localhost:9000
However, if I just go to http://mydomain.com:9000/, I get access to my Play application directly. There's no SSL, and there's no way I can figure out to keep anyone from accessing it.
What should I do? Should I use Nginx to redirect any access on port 9000 to the URL for the SSL version? Should I firewall port 9000 and only allow local requests on that port? (If so, how would I do that?) Is there some other way of dealing with this that I'm not thinking of?
And how long until the Servlet 3.1 spec is released and I can just deploy the whole thing as a WAR? :-)
You could make your Play application listen only on the local interface (127.0.0.1, for example). That way, nginx can still proxy requests to it but nobody from the outside can access your application directly. No additional firewall setup is necessary.
Looks like you can pass an additional argument to start:
$ start -Dhttp.port=9000 -Dhttp.address=127.0.0.1

Xampp's APACHE not working?

I have installed/reinstalled Xampp server on my laptop for a million times now, and still Apache is not running. At first, it will Run, but few moments later it will automatically stop. I don't know what seems to be the conflict. I have checked my Skype since I once met a conflict on the port usage but in this case, I haven't installed Skype. Can someone please guide me on how to make my Apache run successfully. Note that my mySql runs smoothly, only Apache won't. Please help..:(
P.S.
When I run my xampp-control panel, mySql runs smoothly whereas Apache will run for a moment and then will stop, below in the control panel, it will then say apache[port 80] is busy.
What caused this problem on my system (Windows 7) was that the WinHTTP Web Proxy Auto-Discovery Service had stopped running. In the Services part of the Computer Management feature (i.e. the app that runs by selecting Manage from the right-click menu on the Computer link on the Start Menu), I found that WinHTTP Discovery Service was set to 'Manual'. I left it as 'Manual', but started it, and Apache began working again.
Even though I didn't change the 'Manual' nature of the service's startup, I discovered that, after Windows reboot, the WinHTTP service was still running (which was a bit puzzling to me, but there we are). I also don't know what caused this service to stop running on my machine ('but there we are' again!)
Anyway, it seems that having WinHTTP Web Proxy Auto-Discovery Service running is necessary for Apache to run, so make sure it's running!
EDIT TO ADD: I found the root cause of my problem: I'd downloaded a free game that uses Pando (peer-to-peer file sharing app) to allow others to download the game from my machine too (which, in principle, I was okay with), and it uses TCP port 443, which was stopping Apache running. I assume (though really don't know enough about networking to be sure) that the running of the WinHTTP Web Proxy Auto-Discovery Service mentioned above was managing to share (or otherwise work around) the use of port 443.
Open a cmd as Administrator (Start -> "cmd" -> right-click "cmd.exe" -> Run as Administrator)
Type
netstat -nab
Find the line that says
TCP 0.0.0.0:80
well or basically every line that ends with :80
See the exe that's blocking the port above the line.
Terminate the associated program - if nothing else works the Task-Manager should help.
EDIT: Usually IIS would block Port 80 if it is started. There are quite a lot of other programs that could block port 80 though. You can also try and
telnet localhost 80
and see what kind of service answers. Or... use a webbrowser. Or... configure apache to use a different port (but who wants to do that?)
Reconfigure Apache to run on a different port
You might want to pick this path if you don’t want to close the application blocking port 80. A typical reason might be that you want to run say, Apache and IIS on the same machine at the same time.
To configure Apache to run on a different port, goto this path "C:\xampp\apache\conf" (if you install Xampp on diffrent place then navigate to this path) and open httpd.conf in notepad. Search for the following lines:
Line 1 : Listen 80
Line 2 : ServerName localhost:80
Change both these lines, so as to have a different number instead of 80. I have chosen 8000 instead of 80. Make sure that this is a free port, not used by any applications.
Line 1 : Listen 8000
Line 2 : ServerName localhost:8000
Save the file and run Apache from Xampp
Try disabling your Anti-Virus software temporarily. It's known to cause Apache problems. Also check Apache error.log file to see if it has recorded any issues.
Also try some other WAMPs to see if it's a common problem on your system.
Skype automatically blocks the port 80
Stop Skype - Try the apache to start from xampp dashboard
If apache Works - change skype settings
1) In the system tray, we click on the xampp icon.
2) Select Apache> httpd.conf
3) Make a call to Listen 80.
4) Change the number 80 next to Listen to 9080.
5) Restart XAMPP's services

Forward Traffic with Window's Host file?

A long time ago I found some guide that showed how to use the Windows Hosts file to forward traffic to another IP/Port. We setup a clients server on one IP/Port, and they wanted it changed to another IP/Port on the same machine, but are now asking that we forward UDP/TCP traffic to it as well.
I am pretty sure this is doable but I cannot for the life of me figure out how to do it now after Google searching for a while.
You're probably remembering incorrectly. The only thing that /etc/hosts controls is local DNS lookups -- you can't use it to swap ports around or forward data sent from other machines.
You may be able to forward connections using a firewall package or router.