I want to clear that I have already went through this post:
Magento media url - get rid of 403 Forbidden
but I am not still able to get image url from media library. I have tried all these URLs:
localhost/magento/media/customer/pic1.jpg (access forbidden error)
localhost/magento/media/index.html/customer/pic1.jpg (object not found error but image is present)
localhost/magento/media/index.html (working but of no use)
Correct link is localhost/magento/media/customer/pic1.jpg. Try to set correct files ownership and permissions. For apache2 server default configuration:
chown -R www-data:www-data /var/www/html/magento
find /var/www/html/magento/media/ -type f -exec chmod 600 {} \;
find /var/www/html/magento/media/ -type d -exec chmod 700 {} \;