(I'm kinda new to apache). I want to serve a wiki from my server myserver.com. I've created a DNS record for wiki.myserver.com, which can be reached by ssh/http/ping (so, it exists). I have default 000-default.conf, and the following wiki.myserver.conf:
<VirtualHost *:80>
ServerAdmin me#gmail.com
DocumentRoot "/var/www/html/wiki"
ServerName wiki.myserver.com
<Directory /var/www/html/wiki/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/wiki.myserver.com-error_log
CustomLog /var/log/apache2/wiki.myserver.com-access_log common
</VirtualHost>
Output of apache2ctl -t -D DUMP_VHOSTS:
VirtualHost configuration:
*:80 is a NameVirtualHost
default server wiki.myserver.com (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost wiki.myserver.com (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost wiki.myserver.com (/etc/apache2/sites-enabled/wiki.myserver.com.conf:1)
Surfing to http://myserver.com results in default apache2 index page, as expected.
Surfing to http://myserver.com/wiki results in wiki page, as expected (I guess).
Surfing to http://wiki.myserver.com results in default apache2 index page, where I expect the wiki page.
What am I doing wrong? I can't find a difference between my setup and what is generally instructed on the internet.
Can you help by suggesting some ways for debugging?
Any help is appreciated.
Just stupid; I had set my servername in /etc/apache2/conf-available/servername.conf to the wrong default. It's working just fine now.
Related
How to make prestashop to use prestashop.conf file which is a clone of 000.default.conf on my local server?
When I disable 000-default.conf, prestashop don't load.
When I enable that back, the web-page loads normally.
I've enabled prestashop.conf and reloaded/restarted Apache.
I use Apache2, prestashop 1.6.1, OS is Linux Mint.
Maybe someone can give me advice what else should I change. I haven't found solution so far.
P.S. prestashop.conf is complete clone of 000-default.conf.
Have you changed the paths to match these of your website?
<VirtualHost *:80>
ServerAdmin youradminlogin#yourwebsite.com
DocumentRoot "path/of/your/website"
ServerName website-name.com
Options All Indexes FollowSymLinks
<Directory "path/of/your/website">
DirectoryIndex index.html
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
Require local
</Directory>
</VirtualHost>
Make shure it is in /etc/apache2/sites-enabled/ !
After modifying this, you'll need to restart the server (sudo apachectl restart)
I'm developing a web with cakePHP (using MAMP as localhost) and I just configured a virtual hosts to the root of my project.
My /etc/hosts is
127.0.0.1 localhost
127.0.0.1 altair.loc
And my httpd.conf
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Volumes/Macintosh HD/Users/robotThree/www/"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Volumes/Macintosh HD/Users/robotThree/www/ALTAIR/altair/"
ServerName altair.loc
</VirtualHost>
With this I can access to my project typing http://altair.loc and all controllers and actions works perfectly (i.e. http://altair.loc/controller/action).
The problem is that all files accessed statically fails. For example http://altair.loc/css/main.css fails, but it works if I type http://altair.loc/ALTAIR/altair/css/main.css, as if the virtual host wasn't configured.
Do you know what could be happening?
Thank you in advance
Solved. In httpd.conf is necessary to check that Override is for all, it was an .htaccess and mod_rewrite issue:
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
</Directory>
I'm running different websites on my webserver using Apache VirtualHosts. Now I have troubles getting one site to work. When I browse to the site in Firefox it says "Firefox can't find the server at www.mydomain.com", even though it's spelled correctly.
Further traceroute and ping both resolve to the correct IP, so I doubt it is because of a DNS issue.
I copied the VirtualHost-config file from a working site and just changed the domains and path on the server, which is existent. Further I checked that the site is enabled (with a2ensite), restartet apache, reloaded apache, but it is still not working.
Here's my VirtualHost-File:
<VirtualHost censored_ip:80>
ServerName mydomain.com
ServerAlias mydomain.com www.mydomain.com
ServerAdmin <myemail>
DocumentRoot /var/www/efin/
<Directory /var/www/efin/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error_efin.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
I hope someone can find the error here, since I have no idea where to look for it anymore. Thanks a lot in advance. I'd be happy to provide further information if needed.
Sincerely, Michael
I'm clearly missing something, probably something obvious, but I'm just not seeing it. I have a self-signed certificate configured on my MBP (running Apache via Macports). It's a wildcard cert for *.local and I've configured a named virtual host for a site I'm working on, but when I attempt to access it via https, PHP's $_SERVER variables indicate that the SSL access isn't been recognized/respected. Even though I'm accessing https://mynamedhost.local, the PORT key reports port 80 and no HTTPS key exists.
This is a CakePHP site, so the lack of an HTTPS key prevents RequestHandler::isSSL() from reporting true. Any insights would be much appreciated.
Here's my httpd settings output:
$ httpd -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:443 is a NameVirtualHost
default server www.example.com (/opt/local/apache2/conf/extra/httpd-ssl.conf:74)
port 443 namevhost www.example.com (/opt/local/apache2/conf/extra/httpd-ssl.conf:74)
port 443 namevhost mynamedhost.local (/Users/rob/Library/Application Support/MacPorts/apache/conf.d/mynamedhost.conf:17)
*:80 is a NameVirtualHost
default server localhost (/Users/rob/Dropbox/Application Support/apache/conf.d.osx/_localhost.conf:1)
port 80 namevhost localhost (/Users/rob/Dropbox/Application Support/apache/conf.d.osx/_localhost.conf:1)
port 80 namevhost mynamedhost.local (/Users/rob/Library/Application Support/MacPorts/apache/conf.d/mynamedhost.conf:1)
Syntax OK
My namedhost virtual host definition looks like this:
<VirtualHost *:80>
ServerName mynamedhost.local
DocumentRoot /var/www/mynamedhost/app/webroot
ErrorLog /var/www/.logs/mynamedhost_error_log
CustomLog /var/www/.logs/mynamedhost_access_log common
<Directory /var/www/mynamedhost/app/webroot>
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
ServerName namedhost.local
DocumentRoot /var/www/mynamedhost/app/webroot
ErrorLog /var/www/.logs/mynamedhost_error_log
CustomLog /var/www/.logs/mynamedhost_access_log common
<Directory /var/www/mynamedhost/app/webroot>
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
Got it. In the Macports extras/httpd-ssl.conf file, the SSL engine was turned on and the certificate files defined. I thought this would trickle down to custom virtual hosts, but I was wrong. On a lark, I decided to drop the following into the *:443 virtual host definition:
SSLEngine on
SSLCertificateFile "/opt/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/opt/local/apache2/conf/server.key"
Now everything seems to work as expected. I still think I have something funky going on in my config, but this is going to have to be okay for now. For anyone playing at home, the modified virtual host config looks like this (the *:80 config as shown above didn't change):
<VirtualHost *:443>
ServerName mynamedhost.local
DocumentRoot /var/www/mynamedhost/app/webroot
ErrorLog /var/www/.logs/mynamedhost_error_log
CustomLog /var/www/.logs/mynamedhost_access_log common
SSLEngine on
SSLCertificateFile "/opt/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/opt/local/apache2/conf/server.key"
<Directory /var/www/mynamedhost/app/webroot>
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>
I added the following virtualhost (i have the default *:80 one of course) to my apache:
Listen 8989
NameVirtualHost 10.8.0.1:8989
<VirtualHost 10.8.0.1:8989>
DocumentRoot /var/crib
ServerName Thor
ServerAlias Thor
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/crib/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from 10.8.0.0/255.255.255.0 ::1/128
</Directory>
</VirtualHost>
But sometimes it doesn't always respond... so I'm wondering what could be the problem?
I don't even know where to look... 10.8.0.1 is my VPN address. The virtual host 80 works perfectly and am wondering if my configuration has any flaws
Are you planning on having >1 virtual host (diff. hostnames) on that same IP and port? if not, remove the NameVirtualHost option and ServerName and ServerAlias. If you are going to do name based hosting, leave all of that, but use a name that resolves in DNS. You can just put something in /etc/hosts on the local system for testing, but eventually you'll have to get a real hostname for other people to access your site/application.