Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
From what I understand, I dont want IP based hosting. I want name based. I dont have to worry about clients information and security...yet.
I went into my httpd.conf file to try and set it up myself, but its not working. Can anyone (*coughtomcough*) try and help me set up virtual hosting with my apache server.
I agree with gilead, post you're part of the Virtual host setting. We'll try "fixing" it for you. And if needed i'll post my Vhost section that i used to use for my server.
I'm assuming Apache 2.0.x for this... In your httpd.conf file right at the end should be something like the following:
Code:
NameVirtualHost *:80
# This section stops people scanning your web server by IP address
# It acts as a default host so that content is only served for your domains
<VirtualHost *:80>
ServerName default.only
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
<Location />
Order allow,deny
Deny from all
</Location>
</VirtualHost>
# A virtual host
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName www.adomain.com
<Directory "/var/www/html">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I'm also assuming that you have domains registered and delegated to a DNS provider so that they resolve to your IP address.
Yep, my virtual hosting setup is similar to gilead's.
Mark, what do you not understand?
Instead of using this syntax:
Code:
<VirtualHost *:80>
I use this syntax:
Code:
<VirtualHost [IP address]>
I also have "NameVirtualHost [IP address]" specified and the rest just works.
So, after you've posted what you've done thus far we can go from there. You don't need to post the entire httpd.conf, but the virtual host you've defined and any other options you've set with "virtualhost" in the name.
Ok, first tell us what you're wanting to do outside of the high-level "host some websites".
Will these websites all have the same IP address or will they have unique IPs? Or will there be a mixture of IP addresses used?
Will the server they will be hosted on be multi-homed (with either multiple physical or virtual network interfaces)?
If the server will have just one network interface (i.e. one NIC with one IP address), the IP address of the server is the only IP address you will use, both to configure the virtual hosts (unless you use the "*:80" notation above) AND to setup the DNS settings for each website you intend to host.
Here's how it would then work:
I point my browser at markness.com and the DNS comes back with aaa.bbb.ccc.ddd. Then my browser contacts machine aaa.bbb.ccc.ddd on port 80 and your Apache server handles the incoming request. It knows the incoming request is for markness.com and uses the virtual host settings for markness.com to serve up that website.
Later on, I point my browser at somedomain.net and the DNS comes back with aaa.bbb.ccc.ddd, which is the SAME IP returned for markness.com. Then my browser contacts machine aaa.bbb.ccc.ddd on port 80 and your Apache server handles the incoming request. It knows the incoming request is for somedomain.net and uses the virtual host settings for somedomain.net to serve up that website.
So, before we proceed with any virtual hosting setup, you need to let us know what you are wanting to do and what your game plan is. Only then can we provide the best information for you.
Q. Will these websites all have the same IP address or will they have unique IPs? Or will there be a mixture of IP addresses used?
A. I'm assuming because they're coming from my pc with one nic card, that they're all going to use the same ip address.
Q. Will the server they will be hosted on be multi-homed (with either multiple physical or virtual network interfaces)?
A. Not quite sure what you mean by multi-homed. The computer sits in my room on my desk, connected to the internet. There are no other computers on that internet line through routers or anything like that, if thats what you're asking.
All in all, I'm going to have several different domains pointing to my server.
Sorry for the lack of quicker replies. I'm currently registering for classes and dealing with Army BS as usual.
Q. Will these websites all have the same IP address or will they have unique IPs? Or will there be a mixture of IP addresses used?
A. I'm assuming because they're coming from my pc with one nic card, that they're all going to use the same ip address.
No room for assumption here as this is something you really need to know. It's possible to have virtual network interfaces such that a single machine will respond to requests for different and multiple IP addresses. What kind of Internet connection will you be using for this?
Quote:
Q. Will the server they will be hosted on be multi-homed (with either multiple physical or virtual network interfaces)?
A. Not quite sure what you mean by multi-homed. The computer sits in my room on my desk, connected to the internet. There are no other computers on that internet line through routers or anything like that, if thats what you're asking.
Nope, I'm asking if the computer has more than one network interface, either physical or virtual. A physical network interface is a network interface card (NIC), like a 3COM card or whatever brand you use. A virtual network interface is like a physical network interface that doesn't physically exist. The NIC you do have installed would then respond to as many IP address requests it was configured to respond to.
Quote:
All in all, I'm going to have several different domains pointing to my server.
Then assuming they will all have the same IP address, the virtual hosting should be rather simple. If the sites won't have any special requirements, like PHP or stuff like that, mass virtual hosting would be even easier for you.
Here is the template I use for each virtual host I define on my server:
You won't need all of those directives and you might need different ones depending on the site(s) you'll be hosting. The ServerName and ServerAlias directives control the fully qualified domain names (FQDNs) for which the virtual host is defined. The httpd.conf file should have an example of a basic virtual host configuration in it, near the bottom of the file.
No room for assumption here as this is something you really need to know. It's possible to have virtual network interfaces such that a single machine will respond to requests for different and multiple IP addresses. What kind of Internet connection will you be using for this?
I'll be using cable internet.
I will be using PHP on the sites. Would that modify the virtual host config you just posted at all?
Quote:
# Domain: www.mydomain.org
<VirtualHost this is where I put my computers IP address? How do I find that?>
DocumentRoot "/mnt/websites/xxx" <- var/www/html I'm guessing from our previous apache installation?
ErrorLog "| /usr/local/cronolog/sbin/cronolog /usr/local/apache/logs/xxxx/error_log.%Y.%m.%d"
CustomLog "| /usr/local/cronolog/sbin/cronolog /usr/local/apache/logs/xxx/access_log.%Y.%m.%d" combined
ScriptAlias /cgi-bin/ "/mnt/websites/xxx/cgi-bin/"
ScriptAlias /website-stats/ "/mnt/websites/xxx/cgi-bin/website-stats/"
<Directory "/mnt/websites/xxx/cgi-bin/website-stats"> <- how is directory different from document root? Isnt root where all the main files are stored?
AllowOverride AuthConfig
Options None
</Directory>
<Location /cgi-bin/>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>
<Location /website-stats/> <-- is this where my PHP options would go?
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Location>
ServerName xxx
ServerAlias xxx
</VirtualHost>
Also, Tom if you get a chance check out my thread on DVD Shrink in WINE, Trouble locating drives! in the software section of the forums. I could use your help there as well.
I will be using PHP on the sites. Would that modify the virtual host config you just posted at all?
Actually, it could. Some PHP apps want different PHP settings than others. It's funny you mention PHP since I took out the PHP settings I use in my virtual host settings to keep things simple.
That gives me a working PHP4 and mod_perl 2.0.2 Apache 2.0.55 server. The PHP settings you would actually use would depend on your PHP environment. Do not simply use my settings to get something up and running. Print out my settings and go over the Apache doc to see what the directives mean, then craft your own virtual host settings and post them here if you want them peer reviewed.
Quote:
Also, Tom if you get a chance check out my thread on DVD Shrink in WINE, Trouble locating drives!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.