Jump to content

A technical Apache question


scarecrow
 Share

Recommended Posts

I have set up a webserver on a machine with 3 static IP's, pointing to a certain domain name. The domain name is set on a virtual Apache host, while the physical host points to the base IP of the server.

It's using a rather popular CMS, which is working fine.

However, I want to test an alternative CMS on the same server. I can put that one in a folder inside the root folder, and I can assign a DNS to it (say a free one from dyndns). I also want, if possible, to use another port for that one- say 8088 instead of 80.

Question no.1: Can I create another Apache virtual host, which will use as root the subfolder with the new CMS?

Question no.2: Is it possible to run on Apache two virtual hosts, which are using a different port?

You may well assume that I'm no techie, when coming to Apache configs- hence the questions...

Thanks in advance.

 

 

[moved from Everything Linux by spinynorman]

Link to comment
Share on other sites

In answer to your first question, yes you can create a virtual host that uses the sub-folder. For example, you could have a virtual host that uses /var/www/html and you could have the second virtual host using /var/www/html/test for example. I do this already to have multiple sites on a server and I have only one public IP address - but apache knows which host to display based on the domain name accessing the server.

 

As for your second question, yes, you can also to the same with that and use a different port, but if you are using multiple IP's you wouldn't need to use another port, unless you have a particular reason for wanting to assign another port. Your config would look something like:

 

<VirtualHost *:80>
   rest of config here for virtualhost
</VirtualHost>

<VirtualHost *:8088>
   rest of config here for virtualhost
</VirtualHost>

 

of course the * could have been replaced with your particular public IP, unless of course you are using the domain name to distinguish between which virtualhost is detected by the url used.

Link to comment
Share on other sites

I tend to have my virtual hosts set up under /var/www and then the sub-folders are the domains, for example:

 

/var/www/domain1
/var/www/domain2

 

and I then create the VirtualHost accordingly in Apache's /etc/httpd/conf/httpd.conf file (location in CentOS), and towards the bottom of the file is where you'll locate the VirtualHost section.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...