apache_vhost_centos
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| apache_vhost_centos [2015/12/14 11:11] – luke7858 | apache_vhost_centos [2024/05/23 07:26] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | === Configuring | + | === Vhosts |
| - | \\ | + | |
| - | \\ | + | |
| Default configuration file: **/ | Default configuration file: **/ | ||
| You will need to create a vhost in this directory, with the file ending in .conf.\\ | You will need to create a vhost in this directory, with the file ending in .conf.\\ | ||
| Line 9: | Line 7: | ||
| \\ | \\ | ||
| \\ | \\ | ||
| - | ===== Example vhost for apache | + | ==== Example vhost for apache ==== |
| <sxh bash> | <sxh bash> | ||
| < | < | ||
| - | ServerName | + | ServerName |
| - | ServerAlias www.e.com | + | ServerAlias www.example.com |
| - | DocumentRoot / | + | DocumentRoot / |
| - | < | + | < |
| Options Indexes FollowSymLinks | Options Indexes FollowSymLinks | ||
| AllowOverride None | AllowOverride None | ||
| Line 28: | Line 26: | ||
| </ | </ | ||
| \\ | \\ | ||
| - | \\ | + | Globally change website from example.com to your required domain: |
| + | <sxh bash> | ||
| + | : | ||
| + | </ | ||
| === Reloading Apache Configuration === | === Reloading Apache Configuration === | ||
| - | Once the vhost has been created you will need to reload apache for the configuration to take effect:\\ | + | Once the vhost has been created you will need to reload apache for the configuration to take effect\\ |
| - | CentOS/RHL 5,6: | + | |
| - | <sxh bash>service httpd reload</ | + | \\ |
| - | CentOS/RHL 7: | + | === IMPORTANT === |
| - | <sxh bash>systemctl reload httpd</ | + | It is important to note that apache WILL server hidden content (hidden files defined by ' |
| + | \\ | ||
| + | The httpd.conf or apache2.conf file comes with an entry preventing .htaccess and .htpasswd files being served: | ||
| + | <sxh bash> | ||
| + | # The following lines prevent .htaccess and .htpasswd files from being | ||
| + | # viewed by Web clients. | ||
| + | # | ||
| + | <Files ~ " | ||
| + | Order allow, | ||
| + | Deny from all | ||
| + | Satisfy All | ||
| + | </ | ||
| + | </ | ||
| + | \\ | ||
| + | Will will need to add an entry preventing other/all hidden files being served. Add the following content directly under the above content in the httpd.conf (apache2.conf file) | ||
| + | |||
| + | <sxh bash> | ||
| + | < | ||
| + | Order Allow, | ||
| + | Deny from All | ||
| + | Satisfy All | ||
| + | </ | ||
| + | </ | ||
apache_vhost_centos.1450091469.txt.gz · Last modified: 2024/05/23 07:26 (external edit)
