Apache 2.4/ PHP 7.0
Virtual hosts setup working correctly. There are no issues loading JPG files when pointing directly to the server using IP address.
<VirtualHost *:80>
ServerName example.com
DocumentRoot /var/www/html/vhosts/example.com
<Directory /var/www/html/vhosts/example.com>
Require all granted
<FilesMatch ".+\.(gif|jpe?g|png)$">
Require all granted
</FilesMatch>
</Directory>
</VirtualHost>
However the images do not load when pointing to the hostname (example.com).
http://example.com/friendly.jpg Response:
Content-Type: text/html 503 Service Unavailable
As a workaround, I created a PHP symlink to the friendly.jpg
mynewphpfile.php -> friendly.jpg
http://example.com/mynewphpfile.php returns 200 successfully and displays friendly.jpg
Can you help resolve this issue?
Additional Steps
Modified /etc/hosts pointing example.com to IP
Executing from local www server:
curl --head http://example.com/friendly.jpg
Returns: 200 OK successfully (correct image content-length in bytes shown)
Content-Type: image/jpeg
curl -v http://example.com/friendly.jpg
Returns: 200 OK successfully (correct image content-length in bytes shown)
Content-Type: image/jpeg
Executing from external machine:
curl --head http://example.com/friendly.jpg
Returns: 200 OK successfully (correct image content-length in bytes shown)
Content-Type: image/jpeg
curl -v http://example.com/friendly.jpg
Returns: 503 Service unavailable
Content-Type: text/html