Hi All,
For some reason, subdomain I set up doesn't get resolved to correct directory, not quite sure why. I've been researching the issue last 4 days, can't spot the issue in my config, I hope you guys can help.
So, my setup:
xampp 3.2.2, apache 2.4 windows 10.
Trying to configure separate subdomain for images in this instance. Everything seems to be working, subdomain is accessed, subdomain logs get populated, except for the part where the subdomain directory isn't resolved correctly, and I can't get it to work.
Base url access is fine, http://mysite.com/dir/textfile.html works.
However, http://images.mysite.com/icons/icon1.png results in 404, and I get an entry in subdomain's error log - images.mysite.access.log, like so:
127.0.0.1 - - [17/Jul/2020:19:39:00 -0700] "GET /icons/icon1.png HTTP/1.1" 404 1260
If that path (/icons/icon1.png) was appended to specified DocumentRoot for images vhost (c:/Dev/websrc/mysite/images) it would be fine, file is there, and I can access that file from base url just fine, in other words, this works:
http://mysite.com/images/icons/icon1.png, but this doesn't - http://images.mysite.com/icons/icon1.png
My best guess is that images vhosts DocumentRoot is ignored and request is going to what?
Also, same config works on my public server(linux based), it's just with xampp/windows that I am having this strange issue.
windows hosts file:
127.0.0.1 mysite.com
127.0.0.1 images.mysite.com
httpd.conf:
<Directory />
AllowOverride none
Require all granted
</Directory>
httpd-vhosts.conf:
<VirtualHost *:80>
ServerName mysite
ServerAlias www.mysite.com
DocumentRoot "c:/Dev/websrc/mysite"
<Directory "c:/Dev/websrc/mysite">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName images.mysite
ServerAlias images.mysite.com
ServerAlias www.images.mysite.com
ErrorLog "logs/images.mysite.error.log"
CustomLog "logs/images.mysite.access.log" combined
DocumentRoot "c:/Dev/websrc/mysite/images"
<Directory "c:/Dev/websrc/mysite/images">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
httpd -S output:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server mysite (C:/Dev/xampp/apache/conf/extra/httpd-vhosts.conf:17)
port 80 namevhost mysite (C:/Dev/xampp/apache/conf/extra/httpd-vhosts.conf:17)
alias www.mysite.com
port 80 namevhost images.mysite (C:/Dev/xampp/apache/conf/extra/httpd-vhosts.conf:28)
alias images.mysite.com
alias www.images.mysite.com
*:443 www.example.com (C:/Dev/xampp/apache/conf/extra/httpd-ssl.conf:121)
ServerRoot: "C:/Dev/xampp/apache"
Main DocumentRoot: "C:/Dev/websrc/mysite"
Main ErrorLog: "C:/Dev/xampp/apache/logs/error.log"
Mutex ssl-stapling-refresh: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="C:/Dev/xampp/apache/logs/" mechanism=default
PidFile: "C:/Dev/xampp/apache/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: SRVROOT=C:/Dev/xampp/apache
Thanks,
Gator