I have multiple domain on my ubuntu 14.04. The apache do the correct work on all my domains exept on one domain. On that domain it show me the deault page.
Here is mye .conf file, and all the others conf files is like this one, but they havent this problem??
ServerAdmin drift#keber.no
<VirtualHost *:80>
ServerName keber.no
ServerAlias www.keber.no
DocumentRoot /var/www/sites/keber.no
<Directory /var/www/sites/keber.no/>
AllowOverride All
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
Related
I'm trying to configure my apache vhosts file to have a localhost/something hostname and "alias" hostnames. I'm working with google api's currenctly and they are not accepting custom aliases as url's, so I can't make it work with my custom url's. Any thoughts of what to do? My current config that's not working:
<VirtualHost 127.0.0.1:80>
ServerName localhost/go
ServerAlias localhost/go
DocumentRoot "D:/username/Web/server.dev/go"
</VirtualHost>
<Directory "D:/username/Web/">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
<VirtualHost *:80>
ServerName api.server.dev
ServerAlias api.server.dev
DocumentRoot "D:/username/Web/server.dev/api"
</VirtualHost>
##... more custom urls with subdomains cut out because it's unnecessary
<VirtualHost *:80>
ServerName adstrck.server.dev
DocumentRoot "D:/username/Web/server.dev/adstrck"
</VirtualHost>
### ALL OTHERS ###
<VirtualHost *:80>
ServerName www.server.dev
ServerAlias server.dev *.server.dev
DocumentRoot D:/username/Web/server.dev
</VirtualHost>
When I'm trying to access 127.0.0.1/go or localhost/go I get an internal server error.
Maybe what you want is something like this
<VirtualHost 127.0.0.1:80>
ServerName localhost
ServerAlias server.dev *.server.dev
DocumentRoot "D:/username/Web/server.dev"
</VirtualHost>
<Directory "D:/username/Web/server.dev">
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Require all granted
</Directory>
Then use a url like http://localhost/go to view the site.
Depending on your OS/browser, you may be able to add a development subdomain to localhost. E.g.
<VirtualHost *:80>
ServerName dev1.localhost
## rest of your config
## e.g. ServerAlias my.website.on.the.internet.com
DocumentRoot /var/www/dev1
</VirtualHost>
<VirtualHost *:80>
ServerName dev2.localhost
DocumentRoot /var/www/dev2
</VirtualHost>
# Default / catch-all
<VirtualHost *:80>
DocumentRoot /var/www/html
</VirtualHost>
I then pointed my browser to dev1.localhost and that resolved to dev1 and likewise for dev2.localhost and localhost by itself resolved to the default apache page.
This resolved my similar problem. Tested on Apache in a Debian WSL. Worked on Windows Chrome, failed on Windows Firefox. Based on this SO: https://stackoverflow.com/a/35124491
I'm trying to host multiple website on Amazon Ec2 linux, but it is only show the home dashboard website. I try as following virtual host configuration in httpd.conf too.
DocumentRoot "/var/www/html/SITE-1"
ServerName www.myexample1.com
DocumentRoot "/var/www/html/SITE-2"
ServerName www.myexample2.com
If i put like http://10.123.12.12/SITE-1 and http://10.123.12.12/SITE-2 it's getting the right page
But if i given with the DNS name the default page is only loading up, the two different site is not loading up
It looks like your document root is still being set to /var/www/html and you may not have the proper VirtualHost containers. Try something like this:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/html/SITE-1"
ServerName www.myexample1.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/var/www/html/SITE-2"
ServerName www.myexample2.com
</VirtualHost>
<Directory "/var/www/html/SITE-1">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
<Directory "/var/www/html/SITE-2">
AllowOverride None
Order allow,deny
Allow from all
</Directory>
If you need to do SSL, you'll need to include port 443 and some other options.
Been stuck on this one for a little while now. Always get redirected to the index of htdocs.
I've ensured NameVirtualHost is un-commented.
Include conf/extra/httpd-vhosts.conf is un-commented.
I've tried changing the directives under the directory from;
Order allow, deny
Allow from all
To
Require all granted
I've restarted Apache multiple times, flushed DNS.
My files currently look like below;
httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/development"
ServerName testsite.dev
ServerAlias www.testsite.dev
<Directory "C:/xampp/htdocs/development">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
hosts
127.0.0.1 localhost
127.0.0.1 www.testsite.dev
Am I missing something? Any help would be greatly appreciated!
I have a problem with my vhost names. I am setuping a vhost in CentOS based OS. In the host file I added 2 vhost URL. And I also edit the httpd.conf file. I added the vhost directory. I restarted the httpd and I opened the URL in the browser. But it doesn't go to my page. It redirect to other page. Asking for hostnames. Here's my setup.
In my httpd.conf I have this:
<VirtualHost *:80>
DocumentRoot /data/APACHE/html/metro
ServerName store6.giftregistry.com.ph
ServerAlias store6.giftregistry.com.ph
<Directory "/data/APACHE/html/metro">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /data/APACHE/html/metro
ServerName store7.giftregistry.com.ph
ServerAlias store7.giftregistry.com.ph
<Directory "/data/APACHE/html/metro">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
In the hosts file I have this:
10.128.0.63 store6.giftregistry.com.ph
10.128.0.63 store7.giftregistry.com.ph
Is there a mistake with my code?
add
NameVirtualHost *:80
on top..
documentation :
http://httpd.apache.org/docs/2.2/vhosts/name-based.html
I need to install a server with Apache 2.2 on Linux and I need to do two VirtualHosts differentiated by URI.
But with only one domain name and one ip address. And I can't use Alias.
I tried something like that but that doesn't work :
<VirtualHost *:80>
DocumentRoot /var/www/app1
ServerName localhost/app1
ServerAlias www.localhost/app1
<Directory /var/www/app1>
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/app2
ServerName localhost/app2
ServerAlias www.localhost/app2
<Directory /var/www/app2>
Allow from all
</Directory>
</VirtualHost>
Thank you to the first answer here, it's working : https://serverfault.com/questions/588841/two-apps-on-apache-server-with-uri
I put the answer here if one day the link doesn't work :
What you could do is set up a reverse proxy to different virtual hosts listening only on loopback.
You would get in your www.localhost virtualhost:
<VirtualHost *:80>
DocumentRoot /var/www/
ServerName localhost
ServerAlias www.localhost
ProxyPassReverse /app1/ http://webapp1.local/
ProxyPassReverse /app2/ http://webapp2.local/
</Virtualhost>
And create two virtualhosts for the apps:
<VirtualHost 127.0.0.1:80>
DocumentRoot /var/www/app1
ServerName webapp1.local
<Directory /var/www/app1>
Allow from all
</Directory>
</Virtualhost>
<VirtualHost 127.0.0.1:80>
DocumentRoot /var/www/app2
ServerName webapp2.local
<Directory /var/www/app2>
Allow from all
</Directory>
</Virtualhost>
Make sure to add webapp1.local and webapp2.local to your /etc/hosts file.
Since you have only a single domain name and only a single ip address available there is no means for the apache server to distinguish which host is meant. Therefore there is noo sense in defining VirtualHosts here.
However you certainly can place two apps in separate folders inside your DocumentRoot:
ServerName whatever-your-domain.is
DocumentRoot /var/www
<Directory /var/www/app1>
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/app2>
Order allow,deny
Allow from all
</Directory>
Then you'd call those apps by their paths:
apps1: http://whatever-your-domain.is/app1
apps2: http://whatever-your-domain.is/app2
Don't forget to take care of requests to the "main folder" of that single host: /var/www which can be reached by http://whatever-your-domain.is/