0

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>

1 Answer 1

0

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"

2
  • I updated question with the virtual-host file, could you please check it and tell me do you see anything wrong? Jun 11, 2020 at 7:44
  • i checked updated answer of yours but nothing changed... still same problem Jun 11, 2020 at 8:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .