I use centOS server. I want to configure apache to listen on port 8079.
I added LISTEN 8079 directive in httpd.conf
.
I opened port 8079 in iptables and restarted iptables. I even stopped iptables service.
"netstat -nal | grep 8079" shows "tcp 0 0 :::8079 :::* LISTEN"
If I try to access http://localhost:8079
or http://myserver.com:8079
from that machine, I can access that page. BUT from any other machine I am not able to access the site on any port other than 80. On port 80, it works. On port 8079 it does not.
What else do I need to configure?
Open httpd.conf file in your text editor. Find this line:
and change it
After change, save it and restart apache.
For FC22 server
cd /etc/httpd/conf edit httpd.conf [enter]
Change: Listen 80 to: Listen whatevernumber
Save the file
systemctl restart httpd.service [enter] if required, open whatevernumber in your router / firewall
This is working for me on Centos
First: in file /etc/httpd/conf/httpd.conf
add
after
This till your server to listen to the port 8079
Second: go to your virtual host for ex. /etc/httpd/conf.d/vhost.conf
and add this code below
This mean when you go to your
www.example.com:8079
redirect to/var/www/html/api_folder
But you need first to restart the service
sudo service httpd restart
If you are using Apache on Windows:
services.msc
+Enter (if it's not ApacheX.Y, it should have the name of the software you are using with apache, e.g.: "wampapache64");cmd
+Enter is not enough);cd c:\wamp\bin\apache\apache2.4.9\bin
;httpd.exe -n "YourServiceName" -t
(replace the service name by the one you found on step 1);httpd.exe -k stop -n "YourServiceName"
httpd.exe -k start -n "YourServiceName"
If it starts alright, the problem is no longer there, but if you get:
If the port number is not the one you wanted to use, then open the Apache config file (e.g.
C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf
open with a code editor or wordpad, but not notepad - it does not read new lines properly) and replace the number on the line that starts withListen
with the number of the port you want, save it and repeat step 6. If it is the one you wanted to use, then continue:resmon
+Enter, click on Network tab and then on Ports subtab;taskkill /pid NUMBER /f
(/f
forces it);resmon
to confirm that the port is free now and repeat step 6.This ensures that Apache's service was started properly, the configuration on virtual hosts config file as sarul mentioned (e.g.:
C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf
) is necessary if you are setting your files path in there and changing the port as well. If you change it again, remember to restart the service:httpd.exe -k restart -n "YourServiceName"
.It was a firewall issue. There was a hardware firewall that was blocking access to almost all ports. (Turning off software firewall / SELinux bla bla had no effect)
Then I scanned the open ports and used the port that was open.
If you are facing the same problem, Run the following command
It will scan for all the open ports on your system. Any port that is open can be accessed from outside.
Ref.: http://www.go2linux.org/which_service_or_program_is_listening_on_port
If you need a apache Listen port other than 80, you should add in next file under ubuntu
the list of Listen ports
After you have go on your Virtual hosts conf file an define next