1 |
cat /etc/apt/sources.list | perl -ne '$H{$_}++ or print' > /tmp/sources.list && sudo mv /tmp/sources.list /etc/apt/sources.list |
1 |
cat /etc/apt/sources.list | perl -ne '$H{$_}++ or print' > /tmp/sources.list && sudo mv /tmp/sources.list /etc/apt/sources.list |
Use the Ubuntu Sources List Generator.
sudo -H nautilus
in terminal/etc/apt/sources.list
sources.list
and save.
1 2 |
cd /path/to/your/folder/www zip -r filename.zip * |
1 |
unzip folder_name.zip |
Unix zip directory but excluded specific subdirectories (and everything within them)
1 |
zip -r myarchive.zip dir1 -x dir1/ignoreDir1\* dir1\ignorDir2\* |
or
1 |
zip -r myarchive.zip * -x ignoreDir1\* ignorDir2\* |
Prerequisites:-
Make user Apache 2 installed on your server – How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 18.04.
1 2 |
sudo apt-get update sudo apt-get install apache2 |
1 2 |
sudo a2enmod rewrite sudo service apache2 restart |
In this section, we will setup a .htaccess file for simpler rewrite rule management. A .htaccess
press Alt+F2 and type gnome-terminal if you’re using GUI
Then type
1 2 |
sudo nano /etc/apt/sources.list |
(To understand better: in the directory /etc
you can find (nearly) all configuration files of your computer and in the apt
directory you find the souces.list
file that contains all the repositories that APT uses to update or install and upgrade software)
Edit the file removing or commenting
1 2 |
rm -rf /path/to/directory |
1 2 |
rm -rf /path/to/directory/* |
1 2 |
rm -f /path/to/directory/* |
Where:
rm
– stands for “remove“-f
– stands for “force” which is helpful when you don’t want
1 |
sudo adduser {username} www-data |
or
Edit the following file as root: /etc/apache2/envvars
using the command:
1 |
sudo nano /etc/apache2/envvars |
change the user and group to yourself if there is only one user and you will never have permissions problems again.
I.E., if you are only logging in and running the server as user ‘big_dog’:
1 2 |
export APACHE_RUN_USER=big_dog export APACHE_RUN_GROUP=big_dog |
The /var/www folder needs to be readable by the www-data system account. Try this :
1 2 3 |
sudo chown -R www-data:www-data /var/www sudo chown -R krishna:www-data /var/www sudo chmod -R 755 /var/www |
1 2 3 |
sudo chgrp -R www-data /var/www/html sudo find /var/www/html -type d -exec chmod g+rx {} + sudo find /var/www/html -type f -exec chmod g+r {} + |
1 2 |
sudo apt-get update sudo apt-get install apache2 |
sudo apache2ctl configtest
sudo ufw app list
sudo nano /etc/apache2/apache2.conf
Inside, at the bottom of the file, add a ServerName
directive, pointing to your primary domain name. If you do not have a domain name associated with your server, you can use your server’s public IP address:
1 |
ServerName server_domain_or_IP |