I have a Ubuntu server with a static IP address for testing, I would like to create a project (for example, hello-world) outside the / var / www / directory, say, in this place (/ home / username / Webroot / hi-world /). It should be accessible through a browser as follows http://xxx.xxx.xxx.xxx/hello-world/ How to do this?
I would use an alias:
Alias /hello-world /home/www/foo <Directory "/home/www/foo"> Options -MultiViews -FollowSymLinks +SymLinksIfOwnerMatch AllowOverride all </Directory>
you configure the virtual host in your apache configuration file: apache2.conf or httpd.conf:
<VirtualHost *:80> ServerPath /hello-world DocumentRoot /home/username/webroot/hello-world </VirtualHost>
Enable FollowSymlinks in apache and make a link
ln -s /path/to/your/project /var/www/projectname
And updating content is easy without rebooting the server
rm /var/www/projectname ln -s /path/to/your/project-v2 /var/www/projectname