Setting up ModMono With Apache2 - asp.net

I ended up attempting to setup ASP with ModMono on Apache2, via following this guide.
It's not working, however: when I click a .aspx file, I end up just downloading it on my localhost.
Here's my asp.webapp file /etc/mono-server2
<apps>
<web-application>
<name>asp</asp>
<vpath>/asp</vpath>
<path>/var/www/asp/</path>
<vhost>127.0.0.1</vhost>
</web-application>
</apps>
and my asp file in /etc/apache2/sites-available/
<Virtualhost 127.0.1.1:80>
ServerName asp
DocumentRoot /var/www/asp/
<Directory /var/www/asp/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow, deny
Allow from all
SetHandler mono
DirectoryIndex index.aspx index.html
</Directory>
</VirtualHost>
Is there anything which I'm doing wrong here? The only issue I can think of is that I'm trying to reference a directory, rather than a specific page or file.

If you have installed mod_mono and it is configured correctly to work with apache2 then all you will need to do is change your site configuration in /etc/apache2/sites-available/ to something like this:
<Virtualhost 127.0.1.1:80>
ServerName asp
DirectoryIndex index.html index.aspx
DocumentRoot /var/www/asp/
AddMonoApplications asp "/:/var/www/asp"
MonoServerPath asp "/usr/bin/mod-mono-server2"
<Directory /var/www/asp/>
MonoSetServerAlias asp
SetHandler mono
AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
<FilesMatch "\.(gif|jp?g|png|css|ico|xsl|wmv|zip)$">
SetHandler None
</FilesMatch>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow, deny
Allow from all
SetHandler mono
DirectoryIndex index.aspx
</Directory>

Related

How to point URL path to a wordpress folder

I currently have two sites, hosted on the same server using Apache virtual hosts.
http://www.example.com -> /var/www/sites/mysite (path to main website)
http://blog.example.com -> /var/www/sites/blog (path to wordpress folder)
I need my blog to be accessible from www.example.com/blog
I cannot move the wordpress installation into a 'blog' subdirectory of the mysite folder.
Using the Apache Alias directive, I can do the following in the configuration for www.example.com:
Alias /blog /var/www/sites/blog
and access the blog via www.example.com/blog
However the following fails to work with a 404
www.example.com/blog/a-permalink-post-title
I have also tried using the following but the 404 still persists.
AliasMatch /blog/(.*)$ /var/www/sites/blog/$1
The current virtual host configuration looks like this:
<VirtualHost *:80>
ServerName www.example.com
Alias /blog /var/www/sites/blog
DocumentRoot /var/www/sites/mysite
<Directory /var/www/sites/mysite>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
and for blog.example.com
<VirtualHost *:80>
ServerName blog.example.com
DocumentRoot /var/www/sites/blog
<Directory /var/www/sites/blog>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Would greatly appreciate any help with this.

Redmine in subfolder. Drupal (in main folder) handles all requests

I have Redmine in subfolder /var/www/redmine and Drupal in folder /var/www/
When I go to URL mysite.com/redmine, Redmine shows ok, but mysite.com/redmine/login is (over)handled by Drupal.
Apache config is as follows
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
RailsBaseURI /zoo-redmine
PassengerResolveSymlinksInDocumentRoot on
Options Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
It seems a Drupal configuration issue. Try to look in your Drupal configuration panel to exclude from Drupal's login system the /redmine/ subfolder. I can't point you to the exact url because my drupal configuration uses CAS, but it is probably in
Start -> Administration -> Configuration -> People
It was as simple as RewriteRule ^zoo-redmine - [L] before other rewrites in .htaccess
This code exits .htaccess file if encounters zoo-redmine string and don't allow Drupal to readdress this request to index.php with arguments

mod_mono on windows

I am trying mod_mono on apache 2.2.x running on a win7 box – followed the steps described here.
The module loads Ok, but I can't run my ASP.net application (404). Does anybody have any suggestions or an example configuration that works? Thanks.
My working config:
<VirtualHost *:80>
ServerAlias localhost
DocumentRoot "c:\web\mysite"
MonoServerPath mysite "c:\mono\usr\bin\mod-mono-server2.exe"
MonoApplications mysite "/:c:\web\mysite"
<Directory "c:\web\mysite">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
MonoSetServerAlias mysite
SetHandler mono
DirectoryIndex default.aspx index.html
</Directory>
</VirtualHost>
I found a good tutorial for you.
Example mono configuration:
MonoServerPath default /usr/bin/mod-mono_server2
Alias [D] “[P]”
AddMonoApplications default “[D]:[P]”
<Location [D]>
SetHandler mono
</Location>
Another example:
MonoServerPath default /usr/bin/mod-mono_server2
Alias /MySite “/srv/www/htdocs/MySite”
AddMonoApplications default “/MySite:/srv/www/htdocs/MySite”
<Location /MySite>
SetHandler mono
</Location>

is there a version of apache mod_aspdotnet for asp.net 4.0?

or an alternative solution for running asp.net 4.0 in apache that doesnt require to install mono which isnt compatible with everything we use?
Set the configuration file for Apache as follows:
LoadModule aspdotnet_module "modules/mod_aspdotnet.so"
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo
AliasMatch "^/(?i)aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*)" \
"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
<Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
Options FollowSymlinks
Order allow,deny
Allow from all
</Directory>
AspNetVersion v4.0.30319
AspNetMount /ASP "C:/ASP"
Alias /ASP "C:/ASP"
<Directory "C:/ASP">
Options FollowSymlinks Indexes
AspNet files
Order allow,deny
Allow from all
DirectoryIndex index.html index.aspx default.htm default.aspx
</Directory>

Running 2 websites with mono

I have 2 websites: myDomain1.example & myDomain2.example
Both run on the same Apache server with Mono. However my issue is that I cannot get them working at the same time. When I go to myDomain2.example it shows the aspx content of myDomain1.example. Occassiononly this is inversed. So that myDomain1.example shows the content for myDomain2.example. I think this happens when I restart Apache. Anythoughts on what might be happening here?
my Config. ( The config for myDomain2.example is exactly the same except all the relevant properties are called myDomain2.example )
<VirtualHost *:8014>
ServerAdmin webmaster#myisp.com
DocumentRoot /home/advanced/myUserName/public_html/myDomain1.example
ServerName myDomain1.example
ServerAlias www.myDomain1.example devel.myDomain1.example
CustomLog logs/myDomain1.com-access.log combined
ScriptAlias /cgi-bin/ /home/advanced/myUserName/public_html/myDomain1.example/cgi-bin/
## Mono (ASP.NET)
MonoUnixSocket myDomain1.example /home/advanced/myUserName/tmp/mod_mono.sock
MonoWapidir myDomain1.example "/home/advanced/myUserName/tmp/"
MonoApplications myDomain1.example "/:/home/advanced/myUserName/public_html/myDomain1.example/"
AddMonoApplications myDomain1.example "/:/home/advanced/myUserName/public_html/myDomain1.example/"
<Location /myDomain1.example>
AddHandler mono .aspx .ashx .asmx .ascx .asax .config .ascx
MonoSetServerAlias myDomain1.example
</Location>
</VirtualHost>
<Directory /home/advanced/myUserName/public_html/myDomain1.example/cgi-bin/>
SetHandler cgi-script
</Directory>
Since your config file contains a lot of stuff I wouldn't necessarily use, I would suggest starting from the basics and adding stuff until it breaks again.
I'm successfully running multiple sites on my Mono server, and my config is done as follows:
Create a file in your Apache2 sites-enabled folder for each of the domains and add the following:
<VirtualHost *:80>
ServerName www.example.com
ServerAdmin webmaster#example.com
DocumentRoot /var/www/domain1
DirectoryIndex index.html index.aspx
AddMonoApplications blogsite "/:/var/www/domain1"
MonoServerPath blogsite "/usr/local/bin/mod-mono-server2"
<Directory /var/www/domain1>
MonoSetServerAlias domain1
SetHandler mono
AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx
<FilesMatch "\.(gif|jp?g|png|css|ico|xsl|wmv|zip)$">
SetHandler None
</FilesMatch>
DirectoryIndex index.aspx
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
You will obviously have to change all the paths and domains to ones that match your server configuration.

Resources