I'm trying to host my website on single server running centos7.1.
I'm able to virtualhost on port 80
but when I change port of second-site
to 8080
it points to first-site
. However, for URL http://62.210.xx.xx:8080/
its working correctly, pointing to second-site
.
I am doing this way:
httpd.conf
Listen 80
Listen 8080
also tried
Listen 0.0.0.0:80
Listen 0.0.0.0:8080
but same
commented out for apache 2.4
#NameVirtualHost 62.210.xx.xx:80
#NameVirtualHost 62.210.xx.xx:8080
ServerAdmin root@localhost
#first-site.com
<VirtualHost 62.210.xx.xx:80>
ServerName first-site.com
ServerAlias www.first-site.com
DocumentRoot /var/www/first-site
</VirtualHost>
#second-site.com
<VirtualHost 62.210.xx.xx:8080>
ServerName second-site.com
ServerAlias www.second-site.com
DocumentRoot /var/www/second-site
</VirtualHost>
netstat -tulpn | grep httpd
tcp6 0 0 :::80 :::* LISTEN 25253/httpd
tcp6 0 0 :::8080 :::* LISTEN 25253/httpd
/etc/host/
62.210.xx.xx www.first-site.com first-site.com www.second-site.com second-site.com
/usr/sbin/httpd -t
AH00548: NameVirtualHost has no effect and will be removed in the next release /etc/httpd/conf/httpd.conf:46
Syntax OK
Update
apachectl -S
AH00558: httpd: Could not reliably determine the server's fully qualified domain name,
using 62.210.xx.xx. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
62.210.xx.xx:8080 m.second-site.com (/etc/httpd/conf/httpd.conf:427)
62.210.xx.xx:80 is a NameVirtualHost
default server first-site.com (/etc/httpd/conf/httpd.conf:363)
port 80 namevhost first-site.com (/etc/httpd/conf/httpd.conf:363)
alias www.first-site.com
port 80 namevhost image.first-site.com (/etc/httpd/conf/httpd.conf:3 77)
port 80 namevhost m.first-site.com (/etc/httpd/conf/httpd.conf:389)
port 80 namevhost second-site.com (/etc/httpd/conf/httpd.conf:401)
alias www.second-site.com
port 80 namevhost image.second-site.com (/etc/httpd/conf/httpd.conf:415)
port 80 namevhost third-site.com (/etc/httpd/conf/httpd.conf:439)
alias www.third-site.com
port 80 namevhost image.third-site.com (/etc/httpd/conf/httpd.conf:453)
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex fcgid-pipe: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex fcgid-proctbl: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="xxxxxxx" id=1000
Group: name="root" id=0