Last active
August 29, 2015 14:06
-
-
Save lav45/86f5955de622544d760f to your computer and use it in GitHub Desktop.
Apache VirtualDocumentRoot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ServerName localhost | |
AddDefaultCharset utf-8 | |
AddType application/x-httpd-php .php .phtml | |
DirectoryIndex index.html index.htm index.php | |
ServerAdmin [email protected] | |
DocumentRoot /var/www/my | |
<Directory /var/www/my> | |
Options FollowSymLInks SymLinksIfOwnerMatch MultiViews Indexes | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
</Directory> | |
<VirtualHost *:80> | |
CustomLog /dev/null vhost_combined | |
ErrorLog /var/log/apache2/error.log | |
LogLevel warn | |
ServerAlias *.my | |
VirtualDocumentRoot /var/www/my/%-2 | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VirtualDocumentRoot - позволяет без перезапуска Apache быстра создавать новые проекты с таким же именем как и имя папки.
Единственная проблема в переменной
$_SERVER['DOCUMENT_ROOT']
будет находится путь/var/www/my
Таким образом при переходе по следующим ссылкам
будет отображаться один и тот же сайт из
/var/www/my/site