Ubuntu: Whats the simplest way to edit and add files to "/var/www"?

Ubuntu: Whats the simplest way to edit and add files to "/var/www"?

👉 https://amzn.to/4aLHbLD 👈 You’re literally one click away from a better setup — grab it now! 🚀👑 As an Amazon Associate I earn from qualifying purchases. Ubuntu: Whats the simplest way to edit and add files to "/var/www"? Question: Having installed the web server is there a simple way to set a user able to use the graphic interface to copy files and directories to the local web server / var/www I gave myself administrative privileges in Ubuntu but it still doesn't allow copies. Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful): == This solution helped 216 people == If you make /var/www writeable by its group and add the user to the group, that user will not have to use sudo. Try this: sudo adduser <username> www-data sudo chown -R www-data:www-data /var/www sudo chmod -R g+rwX /var/www The user should then be able to edit /var/www/ files without hassle. The first line adds the user to the www-data group, the second line clears up any files with messed up ownership, and the third makes it so that all users who are members of the www-data group can read and write all files in /var/www. If you are logged in as <username> you need to log out and log back in for the group membership to take effect. == This solution helped 25 people == You can chown, that is change the owner of that folder. This will allow you to change the user and group of the folder, allowing your user to add/remove files on it. To do it, replace yourusername with your name and run: sudo chown yourusername.users /var/www And thats it. ---- However, I preffer to create a virtualhost in my home folder, it's much easier. Basically it allows you to use any folder as a apache serving folder. To show it how it simple, lets assume that your username is username and that the folder that you want to serve is /home/username/www Create the following file (for instance mywebprojects) in /etc/apache2/sistes- available replacing the username and the folder path (basically just copy and paste and replace in #CHANGE HERE): <VirtualHost *:80> ServerAdmin webmaster@localhost CHANGE HERE DocumentRoot /home/username/www <Directory /> Options FollowSymLinks AllowOverride None </Directory> CHANGE HERE <Directory /home/username/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/error.log Possible values include: debug, info, notice, warn, error, crit, alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory> </VirtualHost> Now lets create the www folder, add a simple hello world, disable the default website (/var/www), enable our website mywebprojects and restart apache. mkdir ~/www echo "<html><h1>Hello World</h1></html>" > ~/www/test.html sudo a2dissite default # sudo a2ensite mywebprojects sudo service apache2 restart And that it, now you dont need to go to /var/www, you simply add files to your www (or other givename) and it's already there :). With thanks & praise to God! With thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free... | Images: https://stocksnap.io/license & others | With thanks to user Marcos Roriz Junior (https://askubuntu.com/users/5950), user k_graham (https://askubuntu.com/users/8256), user karthick87 (https://askubuntu.com/users/5691), user Jorge Castro (https://askubuntu.com/users/235), user Flimm (https://askubuntu.com/users/2355), user Azendale (https://askubuntu.com/users/9308), and the Stack Exchange Network (http://stackoverflow.com/questions/19.... Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.