Tuesday, September 3, 2019

Creating local virtual directory




#Create soft link:
ln -s /path/to/real/folder /path/to/symbolic/link

# Example:
ln -s /path/to/real/folder /var/www/html/symbolic_link
------------------------------------------------------------------------------------------------

#add virtual domain to yor local machine (hosts file)

sudo nano /etc/hosts
------------------------------------------------------------------------------------------------
# add to follow line and save the file:

127.0.0.1 the-domain-that-you-want-to-add.com

------------------------------------------------------------------------------------------------
#configure your apache to work with the new configured domain in the hosts file

sudo nano /etc/apache2/sites-available/000-default.conf
------------------------------------------------------------------------------------------------
#add the following configuration
<VirtualHost *:80>

    ServerAdmin your@email.com

    ServerName the-domain-that-you-want-to-add.com

    ServerAlias www.the-domain-that-you-want-to-add.com

    DocumentRoot /var/www/html/symbolic_link

    ErrorLog ${APACHE_LOG_DIR}/error.log

    CustomLog ${APACHE_LOG_DIR}/access.log combined

                <Directory /var/www/html/symbolic_link>

                                Options Indexes FollowSymLinks MultiViews

                                AllowOverride All

                                Order allow,deny

                                allow from all

                </Directory>

</VirtualHost>

------------------------------------------------------------------------------------------------

that's it
Now open your browser and navigate to http://the-domain-that-you-want-to-add.com

1 comment:

linux bulk prefix filenames

  In order to bulk add prefix to filenames  in a directory run the following comnmand for f in * ; do mv -- "$f" "2018-05-24_...