Last active
December 31, 2015 05:09
-
-
Save faroncoder/7938883 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuring Apache2 for webhosting multiples of websites on one ip address by using | |
Apache2's "Name-Domain-Based" virtual hosting websites. | |
This httpd.dat holds configurations for 2 websites, simply copy lines between | |
<VirtualHost *:80></VirtualHost>. | |
BIG EMPHASIS TO LEAVE *:80 untouched or whole system will fail. | |
you will see ## EDIT THIS ## which define the line that you can | |
edit whatever you like accordingly. But any lines without that notch, | |
is something you wouldn't want to touch. | |
This also customizes your apache access.log and errors.log to wherever | |
location on your server as you like. | |
<Directory></Directory> is the folder you are hosting your websites | |
and that will becomeS the parent level in tree system inside apache2. | |
i.e. /var/www as parent | |
/var/www/example_ca/ = location of html on www.example.ca | |
/var/www/sample_ca/ = location of html on www.sample.ca |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Directory "/var/www"> ## EDIT THIS ## | |
Options Indexes FollowSymLinks | |
AllowOverride All | |
</Directory> | |
<location /cgi-bin> | |
AddHandler cgi-script .cgi .pl | |
Options -Indexes +FollowSymlinks +ExecCGI | |
</location> | |
<VirtualHost *:80> | |
ServerName example.ca ## EDIT THIS ## | |
ServerAlias www.example.ca ## EDIT THIS ## | |
DocumentRoot /var/www/example_ca/html ## EDIT THIS ## | |
<Location "/"> | |
Order Deny,Allow | |
Deny from all | |
Allow from all | |
</Location> | |
CustomLog /path/to/your/preferred/log-folder/access.log common ## EDIT THIS ## | |
ErrorLog /path/to/your/preferred/log-folder/error.log ## EDIT THIS ## | |
</VirtualHost> | |
<VirtualHost *:80> | |
ServerName sample.ca ## EDIT THIS ## | |
ServerAlias www.sample.ca ## EDIT THIS ## | |
DocumentRoot /var/www/sample_ca/html ## EDIT THIS ## | |
<Location "/"> | |
Order Deny,Allow | |
Deny from all | |
Allow from all | |
</Location> | |
CustomLog /path/to/your/preferred/log-folder/access.log common ## EDIT THIS ## | |
ErrorLog /path/to/your/preferred/log-folder/error.log ## EDIT THIS ## | |
</VirtualHost> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install -y apache2 apache2 apache2-dev apache2-threaded-dev libapache2-mod-perl2 libapache2-mod-php5 | |
## WIRING APACHE2 DEFAULT SETTING ## | |
## ENABLING APACHE2 VIRTUAL HOSTING WITH HTTPD.CONF | |
sudo sed -i -e 's/IncludeOptional sites-enabled/#IncludeOptional sites-enabled/g' /etc/apache2/apache2.conf | |
sudo echo "include httpd.conf" /etc/apache2/apache2.conf | |
sudo echo "<VirtualHost *> | |
</VirtualHost>" >> /etc/apache2/apache2.conf | |
sudo cp -r httpd.dat /etc/apache2/httpd.conf | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Combo of files for script to install apache2 and set up multiple webhosting on host machine on one ip address