Bitzenbytes.com

CompuClues Forum

  User  Password
Tuesday, September 07, 2010 - 03:38 AM
Search
Main Menu
Who's Online
MEMBERS ONLINE

You are an anonymous user. You can register for free by clicking here
User name
Password
 Remember me
Firefox
Get Firefox 110
Languages
Preferred language:


Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Alpha1Offline
Post subject: Apache2 vhosting  PostPosted: May 24, 2010 - 05:04 AM
Member


Joined: Jan 19, 2007
Posts: 262
Location: Edgewater Park, NJ
Status: Offline
It pains me to have to ask about this, but after months of messing around, I've got it, so it looks like its set up right, by it never works right, so I roll it back, to how it was before, with a single host.

It being Vhosting.

I have my server at home, started with one domain, then another, and now, a 3rd that will be running here fairly soon.
With just the 2, using a URL frame for the 2nd worked fine since it was just a one page site. The first domain worked ok anyway.

My server is typical LAMP on opensuse 11.2 on an old desktop.
Its running alpha1beta.com as the primary domain (along with dynDNS) and then simplestart.me which is a URL frame of a directory on the first site.

(i have simplestart.me as a URL frame, and www.simplestart.me as a A record, which shows the other site)

Taking on the 3rd, Is something i cannot do with URL frame anymore, and I am being given a server to run the new domain, and my sites as well, and I need Vhosting.

I'd like to be able to run all 3 domains and several subdomains in their own vhosts, But every time I run through the Vhost using the GUI in httpd setup in Yast, I can never get 2 domains to show up. Only one site shows up on both domains.

I've tried both IP based (Which i know it Not what i need), Just for the heck of it, as well as the name based (I think yast now called it http header based?) virtual hosts. No joy, ever.

I've used several tutorials, and have been working on this from before 11.2 was out, and nothing, so i figured it was time to give in and ask.

I have one IP to the house, So I've got to do name based vhosting.
The box that runs it, runs perfectly fine, minus the vhosting problem.

I'd prefer to do it inside Yast's HTTPD, but I'm not afraid to mess around with the config files a bit, can anyone help me out a bit, pretty please Very Happy

On a side note, do Vhost let you host multiple FTP sites as well?

Thanks in advance
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
NoClueOffline
Post subject: RE: Apache2 vhosting  PostPosted: May 24, 2010 - 03:20 PM
Site Admin


Joined: Jan 17, 2001
Posts: 10454
Location: Blackwood, NJ USA
Status: Offline
alpha1 wrote:
I'd prefer to do it inside Yast's HTTPD


There's your problem. Smile

I've done it with the YaST module, but it always seems to break something. You're gonna have to edit a file by hand. At least one.

Look in /etc/apache2/vhosts.d/. You're looking for a file names vhosts.conf, but YaST might have made one for you called yast2_vhosts.conf. If you have the yast2 one, edit that. If not, edit the other.

From what you've written, you've currently have IP-based virtual hosts and what you'll need is name-based virtual hosts

More soon...
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Alpha1Offline
Post subject: RE: Apache2 vhosting  PostPosted: May 24, 2010 - 04:03 PM
Member


Joined: Jan 19, 2007
Posts: 262
Location: Edgewater Park, NJ
Status: Offline
Right now I have one IP based host. No Vhosts at all, the 2nd domain is actually a page deep inside the first.

I figured it had to be the yast module breaking it, from the folder structure it was all set up, but it would never let me on to both sites at once from the outside world.
I do have the vhost templates that I've messed around with before, and I know you have to add the listener, which I could never get to work right either.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
NoClueOffline
Post subject: RE: Apache2 vhosting  PostPosted: May 24, 2010 - 06:42 PM
Site Admin


Joined: Jan 17, 2001
Posts: 10454
Location: Blackwood, NJ USA
Status: Offline
Yeah, I can't remember exactly what the YaST module broke...I think it kept making a 'default host', wiping out the vhosts. Something like that.

I'd recommend poking through all of the Apache config files on your system. At this point, you're just reading, not changing. Smile

Every distro's Apache install is a little different. In fact, even two boxes with the same distro might be different. As mentioned above, an openSUSE box that has never had the YaST http Server module run on it will use vhosts.conf...and one that has will use yast2_vhosts.conf.

So, while you will probably find the Apache documentation to be very clear and thorough, you'll need to know how your system is different. You can figure that out from the config files. The config files themselves (especially the SUSE-specific ones) are heavily commented, and often explain why they chose to do what they did.

Most config files are called by another config file, using an include directive.

...but on to the vhost setup...

Name-based virtual hosts are pretty cool. The server parses the header from the client (browser, etc.), and serves up the corresponding page. The first vhost listed in the config file is the default host, and is the page served when a client requests a host that doesn't exist...like when you make a typo in a subdomain name. Not that that's ever happened to me before. Very Happy

You can combine name-based and IP-based vhosts on the same server. SSL must be run on an IP-based vhost.

Once upon a time, I had a box that served about 8 name-based vhosts. The vhosts.conf looked something like:

vhosts.conf wrote:
NameVirtualHost *:80
<VirtualHost>
DocumentRoot /srv/www/htdocs/sub1/
ServerName sub1.mydomain.tld
ServerAdmin admin@mydomain.tld
<Directory>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost>
DocumentRoot /srv/www/htdocs/sub2/
ServerName sub2.mydomain.tld
ServerAdmin admin@mydomain.tld
<Directory>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost>
DocumentRoot /srv/www/htdocs/sub3/
ServerName sub3.mydomain.tld
ServerAdmin admin@mydomain.tld
<Directory>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>


...and so on.

There isn't much difference between subdomains and domains. Just make the ServerName directive say your domain, instead of a subdomain.

Your server is serving pages, so I would think you already have a Listen directive somewhere.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
NoClueOffline
Post subject: RE: Apache2 vhosting  PostPosted: May 24, 2010 - 07:44 PM
Site Admin


Joined: Jan 17, 2001
Posts: 10454
Location: Blackwood, NJ USA
Status: Offline
Oh...and for ftp, I would use vsftpd.

I don't know if it's still the SuSE default, but even if not, it's fast and secure.

You might also find the following sites useful:

openSUSE SDB: ftp server

viki - the vsftps wiki

vsftpd Forum
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Alpha1Offline
Post subject: RE: Apache2 vhosting  PostPosted: May 24, 2010 - 07:53 PM
Member


Joined: Jan 19, 2007
Posts: 262
Location: Edgewater Park, NJ
Status: Offline
I've already got FTP running with Vsftpd using the ftp config module in yast, runs perfectly.
I think Aftp is the default, but iuse vsftpd, cause it just works Smile
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
NoClueOffline
Post subject: RE: Apache2 vhosting  PostPosted: Jul 21, 2010 - 02:37 AM
Site Admin


Joined: Jan 17, 2001
Posts: 10454
Location: Blackwood, NJ USA
Status: Offline
Heh, whaddayaknow, they changed it on me. Smile

After creating a vhosts.conf file similar to the one above, running:

/etc/init.d/apache2 start

...gave me the error:

httpd wrote:
Starting httpd2 (prefork) Syntax error on line 2 of /etc/apache2/vhosts.d/vhost.conf: <VirtualHost> directive requires additional arguments


It seems that now:

Quote:
Argument to <VirtualHost> directive

Note that the argument to the <VirtualHost> directive must exactly match the argument to the NameVirtualHost directive.

Code:
NameVirtualHost 1.2.3.4
<VirtualHost 1.2.3.4>
# ...
</VirtualHost>


That would make my example:

Quote:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /srv/www/htdocs/sub1/
ServerName sub1.mydomain.tld
ServerAdmin admin@mydomain.tld
<Directory>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /srv/www/htdocs/sub2/
ServerName sub2.mydomain.tld
ServerAdmin admin@mydomain.tld
<Directory>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /srv/www/htdocs/sub3/
ServerName sub3.mydomain.tld
ServerAdmin admin@mydomain.tld
<Directory>
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Alpha1Offline
Post subject: RE: Apache2 vhosting  PostPosted: Jul 21, 2010 - 08:16 PM
Member


Joined: Jan 19, 2007
Posts: 262
Location: Edgewater Park, NJ
Status: Offline
I have no idea how its done, but apache can run SSL name based virtual hosts.
One link for it: http://www.g-loaded.eu/2007/08/10/ssl-e ... od_gnutls/
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 5 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
Bugs  |  Tasks  |  Developers