Correct permissions for /var/www and wordpress
First, you should ensure that your username is included in www-data
group. If not, you can add your username as www-data
group
sudo adduser $USER www-data
After that, you should change the ownership of /var/www to your username
sudo chown $USER:www-data -R /var/www
Next step, for general practice, you should change permission to 755 (rwxr-xr-x), not recommend changing permission to 777 for security reason
sudo chmod u=rwX,g=srX,o=rX -R /var/www
Related to specific permission for wordpress or laravel or another framework, then you can read the documentation respectively.
Hope it helps...
Apparently this is how it is recommended in the Ubuntu Server Guide:
Chapter 11. Web Servers.
1.4. Sharing Write Permission
For more than one user to be able to write to the same directory it will be necessary to grant write permission to a group they share in common. The following example grants shared write permission to /var/www/html to the group "webmasters"
I use www-data. Just replace "webmasters" with your group, be sure you add the user to the group of course.
sudo chgrp -R webmasters /var/www/html
sudo find /var/www/html -type d -exec chmod g=rwxs "{}" \;
sudo find /var/www/html -type f -exec chmod g=rws "{}" \;
I just tested it with Dreamweaver from my mac desktop and uploaded and replaced files added files etc and it retains the correct permissions with one exception, the local user becomes owner of new files along with www-data, but any files created by root in the html directory retain their ownership as root but are editable by local user.
$ls -l
$-rw-rw-r-- 1 localUser www-data 11505 May 28 09:56 index2.html
$-rw-rwSr-- 1 root www-data 11535 May 28 09:58 index.html
Hope this clears up things and helps the weary, cause I know I was always weary of this situation, but now it is clear to me.
Oh and I highly recommend using sftp with keys to access your ftp, works great for me and don't need PureFTP or any other insecure method of delivering the files to the website. There's a good few tutorials on Digital Ocean site all about securing your server with ssh keys:
How To Configure SSH Key-Based Authentication on a Linux Server
Reading around the instalation guide for Ubuntu..
chown -R www-data /usr/share/wordpress
Maybe it could be easier to instal it this way instead of trying to unzip the files on /var/www
https://help.ubuntu.com/community/WordPress...
any way wordpress runs on apache... right? if you want to do it that way.. you show do as @metamorph an then give permisson on apache2 httpd.conf
like this:
<VirtualHost *:80>
ServerName site
ServerName site.domain
DocumentRoot /srv/www/wordpress.site
DirectoryIndex index.php
</VirtualHost>
and then default-server.conf
.
<Directory "/srv/www/wordpress.site">
Options None
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Maybe is best to do the step by step https://help.ubuntu.com/community/WordPress