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.
Related
<VirtualHost *:80>
ServerAdmin xxx#abc.com
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot /var/www/html/wordpress/
<Directory /var/www/html/wordpress/>
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
ErrorLog /var/logs/error_wp.log
CustomLog /var/logs/access_wp.log combined
</VirtualHost>
I had issues with Wordpress url, then I changed the url to abc.com and now Wordpress renders all pages correctly.
But when it comes to homepage, abc.com, it redirects to abc.com/wordpress/
So whenever I type abc.com in a browser, it redirects to abc.com/wordpress/
And it says "Oops! That page can’t be found."
Wonder where the issue might be.
I'm using default .htaccess for Wordpress. I use a static homepage. Except homepage all other pages work properly. I am able to login using abc.com/wp-admin/
Thanks in advance.
Your directory block should list the path relative to the root, not the absolute path. See if this fixes it:
<Directory />
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
Also, you shouldn't include a trailing slash with your document root.
DocumentRoot /var/www/html/wordpress
Here's the entire corrected config file:
<VirtualHost *:80>
ServerAdmin xxx#abc.com
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot /var/www/html/wordpress
<Directory />
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
ErrorLog /var/logs/error_wp.log
CustomLog /var/logs/access_wp.log combined
</VirtualHost>
The problem was pretty silly. I had set a static page as homepage, which had an entry in db as abc.com/wordpress/. So everytime I click homepage, it would search for abc.com/wordpress/wordpress, which doesn't actually exist.
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.
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>
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>
Here is the problem, if you visit the site directorybest.net you will see the correct website (which is defined in apache). But if you go to the www version of the site a catch all site for and from IIS is displayed. I have no idea what this is causing this.
I have another site that already runs fine on apache from which I copied the info for DNS and vhost settings. I also have set the DNS up so that both sites point to the same ip address. Does anyone know why the www version of the site does not show the right website?
Here is the vhost information for both the working and non working site.
NameVirtualHost *
#non-working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.net
ServerAlias directorybest.net *.directorybest.net
DocumentRoot "D:\WWW\DirectoryBest\2"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\2>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\2\logs\error.log
CustomLog D:\WWW\DirectoryBest\2\logs\access.log combined
</VirtualHost>
#working site
<VirtualHost *>
ServerAdmin admin#email.com
ServerName www.directorybest.info
ServerAlias directorybest.info *.directorybest.info
DocumentRoot "D:\WWW\DirectoryBest\1"
DirectoryIndex index.php
<Directory D:\WWW\DirectoryBest\1>
AllowOverride All
</Directory>
# Logfiles
ErrorLog D:\WWW\DirectoryBest\1\logs\error.log
CustomLog D:\WWW\DirectoryBest\1\logs\access.log combined
</VirtualHost>
Ok so I was just informed that the company has had DNS problems before. And upon further checking the local DNS had not been updated and was still resolving to the old ip address.