Can't see images in localhost - image

I'm starting to develop a site in ubuntu 14.04. I'm using apache2, so I placed my files under /var/www/html/ folder. Everything was working fine, but I had to restart my current work so I copied the entire project folder from another path, like this
$ sudo cp ~/path/to/folder /var/www/html/
And now I can't see my images, a simple imgtag. I just see this.
When I look for the file, I can see that I'm having an error 403 forbidden. I saw some suggestion to add the option Require all granted but that option is already set in my apache. I suspect that is because the new folder is a copy from a folder without root permissions, so I tried chmod but that also didn't work so I'm completly lost now.
So, how can I see my images from localhost? and most important is why this happen suddenly?

Related

Laravel git ignoring images uploaded to storage

I'm running into an issue which i haven't been able to solve yet.
I was working on a laravel project and than moved this project folder to a newer version of MAMP. So far so good, everything was working fine. I just copied all the folders and files and all was good until i logged in to my laravel application on localhost and uploaded some images.
I know i can do this on my host but i like to work on localhost to add content and than push it to my prod env. Anyway, after i uploaded some images and did a git add . and commit it didnt add my uploaded images, on phpstorm they also turn out red in the storage/app/public/images folder.
On my previous mamp version everything used to work fine.
Stuff I have already tried:
I tried deleting the symlink storage folder and make a new link, didn't help.
I tried deleting the storage folder from gitignore, also didn't help.
My gitignore file looks like this:
/node_modules
/vendor
/public/hot
/public/storage
/storage/*.key
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml
npm-debug.log
yarn-error.log
/config/database.php
/public/sitemap.xml
When i login on my prod env and i upload images, they turn up fine, but i prefer sometimes to work from localhost to write content and push it to env.
I have also tried to:
git check-ignore -v -- path/to/file
To check why the file (image) is being ignored but it doesnt return anything.
I got one time a message with: Fatal: pathspec ... is beyond a symbolic link.
I hope someone can push me into the right direction. Thank you.

Laravel project folder permission

I have a problem with my Laravel project on VPS. Locally everything works fine, but on VPS sometimes folder permission changes and web site stops to work. I don't know what causes this problem and what should I do?
Every time I have to fix with this code:
sudo chown -R user:user /data/web/website.com
There may be some script which is rewriting the permissions for your folder. Go with the .htaccess file that will definately work.

Raspberry pi web server

I've been trying to set up my own web server with the raspberry pi3 b+ and it was going good so far i could made a ddns and access it from any other wifi or anything, the only problem was that i couldn't change the default "Debian apache" site.
I googled a lot about it and everybody said that all i have to do is change the root directory /var/www/to my directory but i just couldn't save the files, as it asked me if I wanna overwrite it - I pressed yes but it told me that I don't have permission for that I also couldn't overwrite the index.html file that was in the default folder. Is there anything I can do about it?
I had the same problem while doing this myself. You need to open terminal from the Raspberry Pi, or SSH. You need to change the folder type to 755, which allows the user to read,write,execute. Make sure that the directory you do this to is the /var/www/html folder.
All you need to do is type:
chmod -R 755 (dir)
dir = directory of the file.
If you'd like to change a file, such as the default index.html file in there, use 744 instead of 755.
After this, if you want to start the server, just type in
sudo service apache2 start
Here's a link for how to install the apache2 package.
https://pimylifeup.com/raspberry-pi-web-server/

Forbidden You don't have permission to access {codeigniter} on this server

I am trying to run CodeIgniter for the first time. I have a running apache2 server on my machine. I downloaded CodeIgniter and copy extracted folder it into /var/www/html folder. Also, I set baseUrl config in CodeIgniter
$config['base_url'] = 'http://localhost/codeIgniter';
But I am getting
Forbidden
You don't have permission to access /codeIgniter/ on this server.
I tried setting .htaccess file but couldn't fix the issue. what is the solution for this issue?
This is a pretty vague question but here are some trouble shooting things.
In the HTML folder do: chown -R www-data:www-data nameOfProject.
Also did you set up everything in your apache/sites-available and sites-enabled. Also set up your host file
If this doesn't work just google setting up a ci project.
The reason you had to chown it was to allow appache to access it

Mac Lion Apache can't view files in document root

Apache is running, localhost is working, if I put an index.html that works as well. However I can't access any folders (my websites) within the document root, which is /Users/Me/Sites
I get a forbidden error when I try to access these.
What's going wrong?
You should check the permissions of your home folder and your sites directory to make sure that they allow Apache access.
You could check the permissions, or just run (in a Terminal)
chmod o+x $HOME
chmod -R o+rX $HOME/Sites

Resources