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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...