Mobile app version of vmapp.org
Login or Join
Turnbaugh106

: Apache2 "pseudo" doc root I have several folders in my /www folder that contain various applications. To keep things organized, I keep them in their own folders -- this includes my base application.

@Turnbaugh106

Posted in: #Apache #Apache2 #Htaccess #HttpdConf #Virtualhost

I have several folders in my /www folder that contain various applications. To keep things organized, I keep them in their own folders -- this includes my base application.

Examples:


phpmyadmin = /www/phpmyadmin
phpvirtualbox = /www/phpvirtualbox
root domain site = /www/Landing


The reason I segregate all of my sites is that I actively develop on some of these (my root site) and when I publish via Visual Studio, I choose to delete prior to upload - if I put the Landing page in the base folder, it would be devastating for me.

My goal is that when I go to example.com - I go to my page. If I go to example.com/phpmyadmin, it does not work because of this in the Apache2 folder:

<Location "/"> # Error is the "/"
Allow from all
Order allow,deny
MonoSetServerAlias domain
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
</IfModule>


If I change the location to say "/Other", then the base site is broken, and the aliases are restored for the other sites. If it is "/", then the base site works and no aliases work.

What could I do to allow it to treat my /www/Landing as my webroot, but when I go to an alias, it GOES to the alias.

Edit: Added in the default VirtualHost info.

DocumentRoot /var/www
<VirtualHost *:80>
ServerAdmin info@example.com
ServerName example.com
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType text/css "access plus 1 days"

MonoServerPath domain "/usr/bin/mod-mono-server4"
MonoDebug domain true
MonoSetEnv domain MONO_IOMAP=all
MonoApplications domain "/:/var/www/Landing"

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /Landing/ [L]

#Need to watch what the Location is set to. Can cause issues for alias
<Location "/">
Allow from all
Order allow,deny
MonoSetServerAlias domain
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI ".(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
</IfModule>

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Turnbaugh106

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shanna517

I don't have any experience with Mono, but it seems like the other sites should work if you leave the location as / but only the base site would work if you set the location as /Landing.

What most people would do is simply leave the location as / and use mod_rewrite to map non-phpmyadmin or -phpvirtualbox requests to the /Landing/ directory, e.g.

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /Landing/ [L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme