Can't switch Apache port binding - apache

I have apache 2.2 http server installed on windows 7. Port 80 is already being used and I am attempting to bind apache to an alternative free port. I have amended the C:\Apache\ApacheHTTPserver\Apache24\conf\httpd.txt file to change the value of Listen 80 to Listen 88 or Listen 7777 (I have checked the ports 88 and 7777 are free) and also changed ServerName localhost:80 to ServerName localhost:88 or ServerName localhost:7777 respectively. But when I attempt to start the Apache service I am given an error and it states this in the logs;
The Apache service named reported the following error:
OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : make_sock: could not bind to address 0.0.0.0:80
Why will this not change the Apache port number?

I have discovered what I was doing wrong. I was editing the httpd.conf file by locating it in Windows Explorer and opening in notepad and saving. But when I opened the httpd.conf file using Start >> Apache HTTP Server 2.2 >> Configure Apache Server and amend the port to 88 the service starts okay

Related

What is wrong with my apache Virtual host setup?

I have set up the virtual host like its displayed in the apache documentation:
NameVirtualHost Localhost:8080
<VirtualHost Localhost:8080>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot D:\Users\daniel_diezel\Apache24\htdocs
</VirtualHost>
<VirtualHost Localhost:8080>
ServerName www.otherdomain.tld
DocumentRoot D:\Users\daniel_diezel\Apache24\htdocs
</VirtualHost>
After i saved it and started the httpd.exe the following error accured while starting Apache:
`
(OS 10013)Der Zugriff auf einen Socket war aufgrund der Zugriffsrechte des Sockets unzulõssig. : make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs`
But if i change the Port to 8080 its working.
But the problem no is when the apache starts i cant find the server when i type https://domain.ltd in my browser but if I go for Localhost:8080 it shows me the index file on the site.
What can i do to fix it?
There seems to be two different issues. According to your file structure I assume you are using Windows.
Port usage
Port 80 might be already in use. Open CMD and type netstat -ano and find all processes using port 80 apart from the system process (typically PID 4). Identify the processes by using the command tasklist and look for the PIDs using port 80 from the step before.
Now open your task manager and stop all processes if they are not relevant to keep your system running. Now the port binding error should be gone.
Accessing local domain names
domain.tld is resolved by your configured DNS-provider, so it is looked up to be found in the internet. If you want to resolve domain-names locally (before reaching out for the DNS) you have to add it to your host file.
Open C:/Windows/drivers/etc/hosts with a editor of your choice an add the following line:
127.0.0.1 domain.tld
Now everything should work as expected. If you want to use different ports you can also use 127.0.0.1:port domain.tld

xampp blocking remote external connections

I have read several questions here and still nothing is working.
I am trying to access my test site from a remote computer (either network or wan but i need wan eventually)
I just re-downloaded the newest XAMPP for windows 10.
I can go to localhost (also the other 3 names I setup in the host file to redirect to localhost) and of course 127.0.0.1 (localhost).
If I try and use my ip address of the computer or someone else trys my ip address on their computer, we get page cant be found (from chrome)
If I check apache access logs I see nothing about an access attempt.
Netstat -a shows these two records
TCP 0.0.0.0:80
TCP 0.0.0.0:443
TCP [::]:80
TCP [::]:443
I have gone to Windows Firewall -> Advanced Settings -> Inbound rule. Here it shows that appache has 2 rules, one for UDP and one for TCP allowing all ports.
I have gone to my rounter and port forwarded 80 & 443 (which is what xampp is running on) and still nothing
I even have put my computer in a DMZ. I also turned off the windows firewall. (all back on after testing of course this is dangerous).
Xampp has no locationmatch in xampp-http.conf like other questions.
My vhost file has the directory setup like this:
<Directory "C:/Users/username/Desktop/git repos/stats-website">
AllowOverride All
Order Allow,Deny
Allow from all
Require all granted
</Directory>
This is my testing rig and I am now testing an API that is being accessed externally before I send it to the production server. I have been at this for 2 days and out of all possibilities
UPDATE
I have solved the issue somewhat. I can now get to it from everything except localhost or 127.0.0.1
In httpd.conf I changed it from just Listen 80 to Listen pcipaddress:80. I thought listen 80 defaulted to binding on more than just localhost
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
Listen 192.168.1.241:80
#Listen 80
How do I do it so it works both localhost and also remote connections?

Apache server in port number 80

Though the question asked seems to be very ridiculous but I am practically facing this and left with no option but to ask it.
In httpd.conf file whenever I give port no other than 80 it works fine but if I give port no 80 after some time or may be from beginning it stops working means I am not able to get the desired web page though
when I try netstat -ano it shows that apache server is running on port no 80.
previously IIS7 was working on port no 80.I stoped the process.
Locate your apache config and search for:
Listen 80
change 80 to your desired port
Next you may want to change the vHost setting. Find whereever your vhost settings are located (mostly conf/extra/httpd-vhosts.conf) and locate something like this:
<VirtualHost *:80>
ServerAdmin mail#domain.tld
DocumentRoot "path/to/my/document/root"
ServerName subdomain.domain.tld
ErrorLog "path/to/my/error/log/domain.error.log"
CustomLog "path/to/my/access/log/domain.access.log" common
</VirtualHost>
change the 80 here again to your desired port. Restart your apache.
If youre working on unix:
service apache22 start
service apache22 stop
(commands for apache 2.2)
on windows:
net stop apache2.2
net start apache2.2
(commands for apache 2.2)
Greetings
(make sure your firewall doesnt block your desired port and its not used by another programm. For additional help you should always check your error logs.

Apache http server port change issue

OS: Windows 7
I need to use Apache http server. For the same I downloaded it from Apache lounge. Now, after extracting the Apache24 folder to C:\, if I try to execute httpd.exe command from the bin folder, its giving me the OS 10013 error:
(OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : AH00072: make_sock: could not bind to address [::]:80
(OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : AH00072: make_sock: could not bind to address 0.0.0.0:80
To resolve the same, I modified http.conf file for the following scenario:
a) Changed LISTEN 80 to "LISTEN 8080": Result: again executing the httd.exe command doesn't do anything at all. The command prompt simply sits idle
b) Added "LISTEN 8080" below to LISTEN 80 statement: Result: Again gives back the above OS 10013 error
c) in addition to case b, I also uncommented the servername entry in httpd.conf and made it like: "ServerName localhost:80" : Result: still the same OS 10013 error pops up.

XAMPP Apache server not working on internal network

I have XAMPP installed on my local laptop (Vista) and it works fine. Apache and MySQL are running as services, and I can get to both http://localhost/ and http://192.168.2.2/ without any hassles.
However, if I try accessing the server from another laptop on my internal network by typing in the http://192.168.2.2/ ip address, it errorstimes out. What am I missing here?
When I run Port Check, I get the following:
Service Port Status
==============================================================================
Apache (HTTP) 80 Program: C:\xampp\xampp\apache\bin\httpd.exe
Apache (WebDAV) 81 free
Apache (HTTPS) 443 Program: C:\xampp\xampp\apache\bin\httpd.exe
MySQL 3306 Program: C:\Program Files\MySQL\MySQL Server 5.1\bin
\mysqld.exe
and when I try telnetting to localhost port 80, that works too. My httpd-vhosts.conf file contains the following lines:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/xampp/xampp/htdocs/"
</VirtualHost>
<VirtualHost 192.168.2.2>
ServerName localhost
DocumentRoot "C:/xampp/xampp/htdocs/"
</VirtualHost>
Any thoughts?
Answered via help at ServerFault.com
The problem was that the Windows Firewall had port 80 blocked. To fix this, I opened Windows Firewall, clicked Change Settings, went to the Exceptions tab, and then "Add Port". I set Name to "Web Server (TCP 80)", Port Number to 80, and Protocol to TCP and that was it.