Working with symlinks in apache
ln -s /var/www/mysites /home/storage/mysites
I want to store some websites outside of /var/www by using a symlink. To make that work, I had to set chmod o=x permission for all parent directories of the target path.
chmod o=x /home
chmod o=x /home/storage
chmod ug=rwx,o=x /home/storage/mysites
chown -R www-data:www-data /home/storage/mysites
After that, the sites started to work correctly.
https://superuser.com/a/819999/594216
Virtualhost outside of /var/www
<Directory "/mb/var/www">
Require all granted
</Directory>
<VirtualHost *:80>
ServerName trade.mbirgin.com
ServerAlias trade.lvh.me
DocumentRoot /mb/var/www/mbirgin/trade.mbirgin.com
MonoServerPath trade.mbirgin.com "/usr/bin/mod-mono-server4"
MonoApplications trade.mbirgin.com "/:/mb/var/www/mbirgin/trade.mbirgin.com"
KeepAlive Off
MonoDebug trade.mbirgin.com false
MonoMaxCPUTime trade.mbirgin.com 600
MonoAutoRestartMode Time
MonoAutoRestartTime trade.mbirgin.com 00:09:01:00
<Location "/">
Require all granted
MonoSetServerAlias trade.mbirgin.com
SetHandler mono
</Location>
</VirtualHost>
Enable .htaccess for Apache Server
Edit file: /etc/apache2/apache2.conf
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
sudo service apache2 restart
---------------------
CREATE .htaccess
# put this file in restricted folder and create user/password file by
# htpasswd -c /media/data/Belgelerim/AYARLAR/linux/server/pswd username
# .htaccess processing should be allowed in apache config... To do this add "AllowOverride AuthConfig" to related <Directory> . for example:
#<Directory /var/www/html/test>
# AllowOverride AuthConfig
#</Directory>
AuthName "Secure Area"
AuthType Basic
AuthUserFile /media/data/Belgelerim/AYARLAR/linux/server/pswd
require valid-user