Wenatchee Valley College - CTS Discussion Board

You are not logged in. Would you like to login or register?



5/06/2016 7:51 am  #1


Hosting Multiple Websites on a single Apache Server

Google this topic as per instructions in class and post what you find in reply to this thread.  You must put your name in your post to get credit.

 

 

5/06/2016 8:29 am  #2


Re: Hosting Multiple Websites on a single Apache Server

Tyler Markham
Per this section of some info I found on Apache's website
 https://httpd.apache.org/docs/current/vhosts/examples.html#purename

Basically you just make sure to have a Host (A) record on the DNS server, and from there edit something like this into your httpd.conf:# Ensure that Apache listens on port 80
Listen 80
<VirtualHost *:80>
DocumentRoot "/www/example1"
ServerName www.example.com

# Other directives here
</VirtualHost

Where DocumentRoot is the location of your websites,  ServerName is where you specify the server name matching your Host (A) record, and if you needed any further configuration you could put more instructions there. 

Last edited by forthe48 (5/06/2016 8:45 am)

 

5/06/2016 8:35 am  #3


Re: Hosting Multiple Websites on a single Apache Server

Spencer Oudeans
Open /etc/httpd/conf/httpd.conf and make changes similiar to these:


Listen 81
Listen 82
Listen 83

<VirtualHost *:81>
ServerAdmin asdf@site1.com
DocumentRoot /var/www/site1/html
ServerName site1.com
ErrorLog logs/site1-error_log
CustomLog logs/site1-access_log common
ScriptAlias /cgi-bin/ "/var/www/site1/cgi-bin/"
</VirtualHost>

<VirtualHost *:82>
ServerAdmin asdf@site2.com
DocumentRoot /var/www/site2/html
ServerName site2.com
ErrorLog logs/site2-error_log
CustomLog logs/site2-access_log common
ScriptAlias /cgi-bin/ "/var/www/site2/cgi-bin/"
</VirtualHost>

<VirtualHost *:83>
ServerAdmin asdf@site3.com
DocumentRoot /var/www/site3/html
ServerName site3.com
ErrorLog logs/site3-error_log
CustomLog logs/site3-access_log common
ScriptAlias /cgi-bin/ "/var/www/site3/cgi-bin/"
</VirtualHost>

Then you can refer to your sites by typing the different ports. ( http://ipaddress:81/ or :82 or :83)

I found this info at http://stackoverflow.com/questions/12339044/how-to-run-multiple-sites-on-one-apache-instance , near the bottom of the page

Last edited by Spencer (5/06/2016 8:36 am)

 

5/06/2016 8:45 am  #4


Re: Hosting Multiple Websites on a single Apache Server

Michelle McIntyre

https://debian-administration.org/article/412/Hosting_multiple_websites_with_Apache2<VirtualHost *>

An example!

ServerAdmin webmaster@example.com
ServerName www.example.com
ServerAlias example.com

# Indexes + Directory Root.
DirectoryIndex index.html
DocumentRoot /home/www/www.example.com/htdocs/

# CGI Directory
ScriptAlias /cgi-bin/ /home/www/www.example.com/cgi-bin/
<Location /cgi-bin>
Options +ExecCGI
</Location>


# Logfiles
ErrorLog /home/www/www.example.com/logs/error.log
CustomLog /home/www/www.example.com/logs/access.log combined
</VirtualHost>

:D

Last edited by Michelle (5/06/2016 8:46 am)


 

5/06/2016 8:53 am  #5


Re: Hosting Multiple Websites on a single Apache Server

Devin McPherson

<VirtualHost *:80>
 DocumentRoot /var/www/wordpress
</VirtualHost>


<VirtualHost *:80>
 ServerName wordpress.devuxmachine.local
 DocumentRoot /var/www/wordpress
</VirtualHost>

https://russlescai.wordpress.com/2013/01/03/configure-host-headers-in-apache/

 

5/06/2016 8:53 am  #6


Re: Hosting Multiple Websites on a single Apache Server

1.) Un-comment this part inside the httpd.conf file:

# vi /usr/local/apache2/conf/httpd.conf
Include conf/extra/httpd-vhosts.conf

2.) Setup virtual hosts inside the: httpd-vhosts.conf

NameVirtualHost *:80 – Indicates that all the name-based virtual hosts will be listening on the default port 80

<VirtualHost *:80> </VirtualHost> – Enclose all the apache configuration parameters for each and every virtual host between these VirtualHost tags. Any apache directives can be used within the virtualhost container.

In the following example, we are setting up virtual host for thegeekstuff.com and top5freeware.com listening on the same port 80. So, there will be two <VirtualHost *:80> </VirtualHost>, one for each website.

When you go to thegeekstuff.com, the files under /usr/local/apache2/docs/thegeekstuff will be served by Apache; and the access_log and error_log for this site will go under /usr/local/apache2/logs/thegeekstuff

Which will look like this:

# vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin ramesh@thegeekstuff.com
    DocumentRoot "/usr/local/apache2/docs/thegeekstuff"
    ServerName thegeekstuff.com
    ServerAlias www.thegeekstuff.com
    ErrorLog "logs/thegeekstuff/error_log"
    CustomLog "logs/thegeekstuff/access_log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin ramesh@top5freeware.com
    DocumentRoot "/usr/local/apache2/docs/top5freeware"
    ServerName top5freeware.com
    ServerAlias www.top5freeware.com
    ErrorLog "logs/top5freeware/error_log"
    CustomLog "logs/top5freeware/access_log" common
</VirtualHost>

3.) Verify VirtualHost Syntax using "httpd -S"
Should return this:

# /usr/local/apache2/bin/httpd -S
VirtualHost configuration:
Syntax OK

4.) Restart Apache:

# /usr/local/apache2/bin/apachectl restart

Link: http://www.thegeekstuff.com/2011/07/apache-virtual-host/

Last edited by Alex (5/06/2016 8:54 am)

 

5/06/2016 8:54 am  #7


Re: Hosting Multiple Websites on a single Apache Server

Here's another article from Apache:
http://httpd.apache.org/docs/2.4/vhosts/name-based.html

 

5/09/2016 9:20 am  #8


Re: Hosting Multiple Websites on a single Apache Server

Josh Philley

Configuring SSL Host Headers in IIS 8 and IIS 8.5


IIS 8 and IIS 8.5: Host Headers, Secure Site Bindings, and SSLBackgroundIn IIS 7, if you used host headers with an SSL Certificate, the same certificate had to be used for every site that was secured. If multiple SSL Certificates were used, the server usually had a problem with providing the correct SSL Certificate when an HTTPS connection was established, which caused a certificate name error. See Name Mismatch in Web Browser.For IIS 7, see Configuring SSL Host Headers in IIS 7.
For IIS 6, see Configuring SSL Host Headers in IIS 6.Server Name Indication (SNI) with Multiple SSL CertificatesIIS 8 supports the TLS Server Name Indication (SNI) extension. From a single IP address and port, you can use multiple SSL certificates to secure various websites on a single domain (e.g., www.yourdomain.com, site2.yourdomain.com) or across multiple domains (e.g., www.domain1.com, www.domain2.com). For example, instead of requiring a different IP address for each SSL site, you can use SNI to install and configure multiple SSL sites to one IP address.For more information about installing multiple certificates using SNI, see How to install and configure your SSL Certificate on Windows Server 2012 - IIS 8 and Windows Server 2012 R2 - IIS 8.5 (Multiple Certificates Using SNI).Since Server Name Indication (SNI) is a new feature, not all browsers support it.
For information about broswer support for IIS 8, see IIS 8 and IIS 8.5 SNI Browser Support.Host Headers with SSL Certificates that Cover Multiple WebsitesIf you use host headers in combination with certificates that can cover more than one website (Wildcard or Multi-Domain (SAN) Certificates) you can secure multiple sites on one IP.A Wildcard Certificate secures any subdomain of the domain to which it was issued. For example, a DigiCert® Wildcard Plus™ Certificate that is issued to *.domain.com will cover something.domain.com, anything.domain.com, and whatever.domain.com.A single DigiCert Multi-Domain (SAN) Certificate can secure multiple fully qualified domain names, and DigiCert Multi-Domain (SAN) Certificates are compatible with almost all major server types. The difference between DigiCert Multi-Domain (SAN) Certificates and DigiCert® Wildcard Plus™ Certificates is that while DigiCert® Wildcard Plus™ Certificates work on multiple websites because of the * character in the domain name, DigiCert Multi-Domain (SAN) Certificates include a Subject Alternative Name (SAN) field that allows the certificate to include multiple names. For example, a Multi-Domain (SAN) Certificate can include www.domain.com, www.domain2.com, www.domain3.com, and mail.domain3.com. The certificate can then be installed to all four sites. When connecting to any of those sites, a browser checks the name that it is connecting to against the list of SAN names in the certificate. As long as a valid match is found, no error message is displayed.There are two ways to set up host headers in IIS 8. We recommend using the DigiCert® Certificate Utility for Windows and the IIS 8 GUI to set up the host headers and site bindings. However, you can also use the command line to configure SSL host headers.

IIS 8 and IIS 8.5: Using the DigiCert® Certificate Utility for Windows and IIS Interface to Set Up Host HeadersTo set up host headers in IIS 8, you need to format the friendly name to start with an * character. Using our DigiCert® Certificate Utility for Windows to reformat the friendly name is very easy. After you format the friendly name, you can use IIS 8 to set up host headers and site bindings. Formatting the Friendly Name
[list=1]
  • On your Microsoft server, download and run the DigiCert® Certificate Utility for Windows.
  • In DigiCert Certificate Utility for Windows©, right-click on your certificate and then, click Edit friendly name.
  • Enter a friendly name for the certificate and make sure that the name starts with an *. You will use this name to identify this certificate.We recommend that you add DigiCert and the expiration date to the end of your friendly name, for example: *.yourdomain.com (DigiCert)(Expiration date). This information helps identify the issuer and expiration date for the certificate.
  • Click Save.
  • After you give your SSL Certificate a friendly name, you can now use the IIS interface to configure the host headers and site bindings.For a website without a binding for https, see Adding Site Bindings (Website Does Not Have Binding for https).
  • For a website with a binding for https, see Editing Site Bindings (Website Has Binding for https).

    Adding Site Bindings (Website Does Not Have Binding for https)
    [list=1]
  • Open Internet Information Services (IIS) Manager.From the Start screen, type and click Internet Information Services (IIS) Manager.
  • In Internet Information Services (IIS) Manager, under Connections, expand your server’s name, expand Sites, and then, click the site that you want to secure.
  • In the Actions menus, under Edit Site, click Bindings.
  • In the Site Bindings window, click Add.
  • In the Add Site Binding window, enter the following information:TypeIn the drop-down list, select https.IP addressIn the drop-down list, select All Unassigned.PortEnter 443.Host nameEnter your website’s DNS name (e.g. website1.domain.com).Require Server Name IndicationDo not check this check box; not required.SSL certificateIn the drop-down list, select the SSL Certificate by its friendly name (*YourCertificateFriendlyName).
  • Click OK.The host headers should now be properly configured for that website.
  • Repeat these steps as needed for all sites to which you want to assign SSL host headers.Note:     In step 5, change the host name to match the website's DNS name each time.
  • You can verify the changes by opening each site in a web browser.If the wrong page is displayed for any URL, your SSL host headers have not been configured correctly.

  • Editing Site Bindings (Website Has Binding for https)
    [list=1]
  • Open Internet Information Services (IIS) Manager.From the Start screen, type and click Internet Information Services (IIS) Manager.
  • In Internet Information Services (IIS) Manager, under Connections, expand your server’s name, expand Sites, and then, click the site that you want to secure.
  • In the Actions menus, under Edit Site, click Bindings.
  • In the Site Bindings window, select the https binding for this website and then, click Edit.
  • In the Edit Site Binding window, set the following options:IP addressIn the drop-down list, select All Unassigned. If your server has multiple IP addresses, select the one that applies.Host nameEnter your website’s DNS name (e.g. website1.yourdomain.com).SSL certificateIn the drop-down list, select the SSL Certificate by its friendly name (*YourCertificateFriendlyName).
  • Click OK.
  • Repeat these steps as many times as needed for all of the sites to which you want to assign SSL host headers.Note:    In step 5, change the host name to match the website's DNS name each time.
  • You can verify the changes by opening each site in a web browser.If the wrong page is displayed for any URL, your SSL host headers have not been configured correctly.

  • IIS 8 and IIS 8.5: Using the Command Line to Set Up Host HeadersUsing the Command Line to Set Up Host HeadersIf the friendly name does not have a * character, you need to use the command line to configure SSL host headers to use your SSL Certificate on multiple websites.
    [list=1]
  • Install the SSL Certificate to the server that hosts the site where you will secure https bindings.For instructions about installing the SSL Certificate on a IIS 8 server, refer to the IIS 8 and IIS 8.5 SSL Certificate Installation instructions.
  • On the server, open a command line.On the Start screen, type and click Command Prompt.
  • To change the directory where you manage SSL host headers, in the Command Prompt, type cd C:\Windows\System32\Inetsrv\ and then press Enter.
  • On one line, type the following command:appcmd set site /site.name:"Name of Website in IIS" /+bindings.[protocol='https',bindingInformation='*:443:Host Header']To find the Name of Website in IIS and the Host Header:
  • [list=1]
  • Open Internet Information Services (IIS) Manager.On the Start screen, type and click Internet Information Services (IIS) Manager.
  • In Internet Information Services (IIS) Manager, under Connections, click Sites.
  • In the center section, the name of website in IIS is listed in the Name column.
  • In the Binding column, the host header value is the value that is assigned to it.

  • In the Command Prompt, you should see a response message “SITE object ‘your site’ changed”.
  • Repeat these steps as needed until you have set up SSL host headers for all websites that need them.If you need to enter the command for multiple sites, we recommend that you use our DigiCert IIS 8 and IIS 8.5 SSL Host Header Command Generator.
  • You may need to restart the IIS sites for the changes to take effect.
  • To verify your changes, open each site in a web browser.If the browser displays the wrong page for any URL, you have not configured your SSL host headers correctly.
  • Last edited by soberbeacon (5/09/2016 9:23 am)

     

    5/09/2016 9:36 am  #9


    Re: Hosting Multiple Websites on a single Apache Server

     https://httpd.apache.org/docs/current/vhosts/examples.html#purename

    I think this link was already posted, but these were the best instructions I could find. 

     

    5/11/2016 9:04 am  #10


    Re: Hosting Multiple Websites on a single Apache Server

    Bob Clarke

    Currently following these directions to configure apache for the websites used earlier in the class.

    https://drupalize.me/blog/201504/configure-apache-multiple-domains

    =16pxThe tutorial, takes three domains and makes them all resolve to one Drupal directory on a web server. We confirmed the domains were pointed to the correct server, then we configured our Apache vhosts. We walked through the necessary steps for doing this on Ubuntu, which included creating a sites-available=16px file, adding the minimal vhost directives we needed, and then enabling the site. With the vhost configuration in place, we reloaded Apache to make sure it was properly reading the new configuration. After Apache reloaded, we went to our domain names in a browser and found a Drupal installation screen waiting for us.

     

    Board footera

     

    Powered by Boardhost. Create a Free Forum