Uploaded images do not show on localhost

I'm working with Wordpress 3.3.1 on a local installation. I've uploaded an image file and it doesn't show up.

The base directory is a symbolic link /var/www/wordpress/ that leads to /usr/share/wordpress/

The file exists here: /srv/www/wp-uploads/localhost/2013/01/Logo.png

Wordpress thinks the file is here: http://localhost/wordpress/2013/01/Logo.png (Apache gives 404)

How can I configure Apache or Wordpress to get the correct file?

I'm confused because /srv/www/localhost/ contains the Wordpress files (as well).

Also, I've found questions related to wp-content/uploads but this directory doesn't exist.

Topic uploads Wordpress

Category Web


I solved this by creating a symbolic link in the /var/www/ directory.

ln -s /srv/www/wp-uploads/localhost/ wp-uploads

This is probably an ugly hack and there must be something wrong with the Apache configuration, but it works for the Sandbox.


It would seem your permissions and / or ownership on /usr/share/wordpress/ could be wrong. Try setting this directory to 777 and CHOWN the owner to Apache (on Ubuntu it runs as user www-data).

If WordPress was unzipped/expanded in /usr/share/wordpress you would have a folder wp-content - and the /uploads folder should be created in there (assuming permissions etc are right).

You also mention /srv/www/wp-uploads/localhost/ and /srv/www/localhost/ -- so maybe you were changing your VHOST files too? Have you enabled mod-rewrite or anything different?

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.