i have centos 7 and installed apache server on vps. listening 80, 8002 ports in httpd.conf
Listen 80
Listen 8002
also checked the $ netstat -anp | grep 8002
tcp 0 0 0.0.0.0:8002 0.0.0.0:* LISTEN 10186/httpd
there is no problem. it's listening and I opened the port via firewalld and –reload
here is the opened ports $ firewall-cmd --list-ports
, output
80/tcp 8002/tcp
the result is, when I check the on the browser. I can see website on port 80
BUT on <IP address:8002>
there is problem. It tries to connect and in the end "ERR_CONNECTION_TIMED_OUT"
error is returning.
So I went to terminal and the address with a $ telnet <IP address> 8002
and it returned connected
Additionally I run curl <IP address:8002>
and it returned the html
without a problem as expected. But I am not very sure why I can't connect the :8002
on browser. And why I can see the :80
… what is the difference?
virtual-host conf
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot /var/www/dom1/
ErrorLog /var/www/dom1/error.log
CustomLog /var/www/dom1/access.log combined
</VirtualHost>
<VirtualHost *:8002>
ServerName localhost
ServerAlias localhost
DocumentRoot /var/www/dom2/
ErrorLog /var/www/dom2/error.log
CustomLog /var/www/dom2/access.log combined
</VirtualHost>
Best Answer
Check for the virtual hosting configurations. Running sites on different ports.
Reference Link:
https://httpd.apache.org/docs/2.4/mod/core.html#virtualhost https://httpd.apache.org/docs/2.4/vhosts/examples.htm.
I would recommend you to check for the apache error logs and use the correct server name.
Listen 80 Listen 8080
ServerName www.example.com DocumentRoot "/www/domain-80"
ServerName www.example.com DocumentRoot "/www/domain-8080"
ServerName www.example.org DocumentRoot "/www/otherdomain-80"
ServerName www.example.org DocumentRoot "/www/otherdomain-8080"