You are not logged in.

#1 2013-06-18 18:01:36

tritron4
Member
Registered: 2012-04-14
Posts: 153

Help with apache and virtual hosts

I hope someone can help me I had installed shared point for testing and learning it. I had setup alternative mapping and know I want to add sub domain to my Apache web server. So I have sub domain redirecting back to share point. Also mine website is being redirected to share point. How I can have sub domain redirected to share point and main website go to my drupal ? I had created virtual host for main website but I still  get redirected to share point.

Offline

#2 2013-06-18 19:09:27

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: Help with apache and virtual hosts

Virtual hosts let you use one and the same machine for many different websites, see http://httpd.apache.org/docs/2.4/vhosts/ for details.

You want to use one machine for one website, which is accessible via example.com, and another machine for another website, which is accessible via subdomain.example.com, if I understood you correctly. If that's the case virtual hosts won't help you because you are using real hosts (two of them). Instead you will have to make sure that requests to example.com and subdomain.example.com are sent to the correct machines running apache.

I have not yet played around with domain names on that level so I can't really help you there but wikipedia should give you a nice start.

Offline

#3 2013-06-19 12:20:42

tritron4
Member
Registered: 2012-04-14
Posts: 153

Re: Help with apache and virtual hosts

I have this and the problem is that main domain goes to share point.

<VirtualHost xxxx.us:80>
    ServerName xxxx.us
    ServerAlias www.xxxx.us
    DocumentRoot "/srv/http"
    ServerAdmin root@xxxx.us
    ErrorLog "/var/log/httpd/error_log"
    CustomLog "/var/log/httpd/access_log" common
    <Directory />
    Options FollowSymLinks
    AddHandler cgi-script .cgi .pl
    Options ExecCGI Indexes FollowSymLinks MultiViews +Includes
    AllowOverride None
    Order deny,allow
    Deny from all
    </Directory>
</VirtualHost>

<VirtualHost sharepoint.xxxx.us:80>
    ServerName sharepoint.xxxx.us
    ServerAlias sharepoint.xxxx.us
    DocumentRoot "/srv/http"
    ServerAdmin root@xxxx.us
    ErrorLog "/var/log/httpd/error_log"
    CustomLog "/var/log/httpd/access_log" common
    RewriteEngine On
    RewriteLog "/var/log/httpd/rewrite_log"
    RewriteLogLevel 9
    RewriteCond %{HTTP_HOST} !^(sharepoint\.)?hebe\.us$
    RewriteRule ^(.*)$ http://hebe.us$1 [L,R=301]
    ProxyRequests On
    ProxyPreserveHost On
    ProxyVia full
    ProxyPass /  http://192.168.0.38/
    ProxyPassReverse / http://192.168.0.38/
</VirtualHost>

Last edited by tritron4 (2013-06-19 17:01:08)

Offline

#4 2013-06-19 13:15:44

cookies
Member
Registered: 2013-01-17
Posts: 253

Re: Help with apache and virtual hosts

mod_proxy looks like a nice feature, didn't know about it.

tritron4 wrote:
<VirtualHost sharepoint.xxxx.us:80>
    ServerName sharepoint.xxxx.us
    ServerAlias sharepoint.xxxx.us
    DocumentRoot "/srv/http"
    ServerAdmin root@xxxx.us
    ErrorLog "/var/log/httpd/error_log"
    CustomLog "/var/log/httpd/access_log" common
    RewriteEngine On
    RewriteLog "/var/log/httpd/rewrite_log"
    RewriteLogLevel 9
    RewriteCond %{HTTP_HOST} !^(sharepoint\.)?hebe\.us$
    RewriteRule ^(.*)$ http://hebe.us$1 [L,R=301]
    ProxyRequests On
    ProxyPreserveHost On
    ProxyVia full
    ProxyPass /  http://192.168.0.38/
    ProxyPassReverse / http://192.168.0.38/
</VirtualHost>

According to http://httpd.apache.org/docs/2.4/mod/mod_proxy.html you want to set up a reverse proxy. So try and use just

ProxyPass / http://192.168.0.38/
ProxyPassReverse / http://192.168.0.38/

and leave out the other proxy related lines. If that works you can continue from there.

Offline

#5 2013-06-20 00:07:11

tritron4
Member
Registered: 2012-04-14
Posts: 153

Re: Help with apache and virtual hosts

I added NameVirtualHost         *:80 at that solved my issue

Offline

Board footer

Powered by FluxBB