hosting_more_than_one_website_on_the_same_apache2_server
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
hosting_more_than_one_website_on_the_same_apache2_server [2016/07/24 19:15] – created walkeradmin | hosting_more_than_one_website_on_the_same_apache2_server [2023/03/09 22:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
\\ | \\ | ||
\\ | \\ | ||
- | From time to time it might be necessary | + | Setting up Apache2 |
+ | \\ | ||
+ | \\ | ||
+ | In the folder // | ||
+ | \\ | ||
+ | \\ | ||
+ | sudo nano / | ||
+ | \\ | ||
+ | In the apache2.conf look for the section that points to the default site (which is normally /var/www) | ||
+ | \\ | ||
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride All | ||
+ | Require all granted | ||
+ | </ | ||
+ | \\ | ||
+ | We need to copy and paste this section for each site we wish to create.\\ | ||
+ | \\ | ||
+ | In this example we will have two websites, site one and site2, and they are located in the following place: | ||
+ | \\ | ||
+ | \\ | ||
+ | / | ||
+ | / | ||
+ | \\ | ||
+ | \\ | ||
+ | So we need to add two sections to the / | ||
+ | \\ | ||
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride All | ||
+ | Require all granted | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | Options Indexes FollowSymLinks | ||
+ | AllowOverride All | ||
+ | Require all granted | ||
+ | </ | ||
+ | \\ | ||
+ | Save this file and exit back to the command line. | ||
+ | \\ | ||
+ | \\ | ||
+ | now we need to navigate to the folder // | ||
+ | \\ | ||
+ | sudo / | ||
+ | \\ | ||
+ | Use the hash # to comment out every line | ||
+ | \\ | ||
+ | \\ | ||
+ | Now add the following: | ||
+ | \\ | ||
+ | < | ||
+ | ServerAdmin al@nwalker.co.uk | ||
+ | ServerName site1.alanwalker.eu --- (this has to match the url of your website) | ||
+ | DocumentRoot / | ||
+ | DirectoryIndex index.html --- (this is the first page of your website) | ||
+ | </ | ||
+ | < | ||
+ | ServerAdmin al@nwalker.co.uk | ||
+ | ServerName site2.alanwalker.eu --- (this has to match the url of your website) | ||
+ | DocumentRoot / | ||
+ | DirectoryIndex index.html --- (this is the first page of your website) | ||
+ | </ | ||
+ | \\ | ||
+ | Don't forget to restart the apache web server: | ||
+ | \\ | ||
+ | sudo / | ||
+ | \\ | ||
+ | \\ | ||
+ | Now if I navigate to // | ||
+ | \\ | ||
+ | \\ | ||
+ | {{: | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | If I navigate to // | ||
+ | \\ | ||
+ | \\ | ||
+ | {{:site2.png|}} | ||
+ | \\ | ||
+ | \\ | ||
+ |
hosting_more_than_one_website_on_the_same_apache2_server.1469384104.txt.gz · Last modified: 2023/03/09 22:35 (external edit)