I have virtual machine running Ubuntu.
I want to type in browser "http://localhost/mwiki" and see my MediaWiki site.
I put this site into /var/www/mwiki folder and I configured Apache "default" file.
But when I try to open this site in browser – following web page opened:
" The requested URL /mwiki/ was not found on this server
Apache/2.2.11 (Ubuntu) mod_python/3.3.1 Python/2.6.2 Server at localhost Port 80".
Also on this server is running another site (ReviewBoard system).
And it runs perfectly. When I type "localhost/reviews" I get the index page of this site.
I have minimal knowledge of configuring Apache.
Please, help.
/etc/apache2/sites-available/default
:
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/var/www/mwiki"
AddDefaultCharset UTF-8
<Location "/mwiki">
Order allow,deny
Deny from all
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
DocumentRoot "/var/www/reviews.mysite.com/htdocs"
AddDefaultCharset UTF-8
# Error handlers
ErrorDocument 500 /errordocs/500.html
# Serve django pages
<Location "/reviews/">
PythonPath "['/var/www/reviews.mysite.com/conf'] + sys.path"
SetEnv DJANGO_SETTINGS_MODULE reviewboard.settings
SetEnv PYTHON_EGG_CACHE "/var/www/reviews.mysite.com/tmp/egg_cache"
SetEnv HOME "/var/www/reviews.mysite.com/data"
SetHandler mod_python
PythonHandler django.core.handlers.modpython
PythonAutoReload Off
PythonDebug Off
# Used to run multiple mod_python sites in the same apache
PythonInterpreter reviewboard_reviews_mysite_com
</Location>
<Location "/reviews/media">
SetHandler None
</Location>
# Serve static media without running it through mod_python
# (overrides the above)
<Location "/reviews/errordocs">
SetHandler None
</Location>
<Directory "/var/www/reviews.mysite.com/htdocs">
AllowOverride All
</Directory>
# Alias static media requests to filesystem
Alias /reviews/media "/var/www/reviews.mysite.com/htdocs/media"
Alias /reviews/errordocs "/var/www/reviews.mysite.com/htdocs/errordocs"
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
Best Answer
You've a misunderstanding of how
<VirtualHost >
works. When using name-based virtual hosting (that is, same IP, multiple hostnames to distinct them), you need to have uniqueServerName
s.Furthermore, you've set your
DocumentRoot
to/var/www/mwiki
which causeshttp://localhost/
to show your wiki. Since you've one ServerName only (localhost
), I suggest you to add anAlias
instead of a virtual host.Virtual Hosts are only useful if you've multiple IPs or hostnames. Examples:
Added to
/etc/hosts
:You can now visit the hosts using the {site1,site2,meh}.example.com domains. If you open 127.0.0.1 or
invalid.example.com
, the first vhost (site1.example.com
) will be picked.