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/03/28 10:46] – 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 7: | Line 5: | ||
__For example: | __For example: | ||
**/ | **/ | ||
- | + | \\ | |
- | + | \\ | |
- | ===== Example vhost for apache | + | ==== Example vhost for apache ==== |
<sxh bash> | <sxh bash> | ||
< | < | ||
- | ServerAdmin [email protected] | ||
- | |||
ServerName example.com | ServerName example.com | ||
ServerAlias www.example.com | ServerAlias www.example.com | ||
- | DocumentRoot / | + | DocumentRoot / |
- | < | + | < |
Options Indexes FollowSymLinks | Options Indexes FollowSymLinks | ||
AllowOverride None | AllowOverride None | ||
Line 25: | Line 21: | ||
</ | </ | ||
- | ErrorLog | + | ErrorLog |
- | CustomLog | + | CustomLog |
</ | </ | ||
</ | </ | ||
+ | \\ | ||
+ | Globally change website from example.com to your required domain: | ||
+ | <sxh bash> | ||
+ | : | ||
+ | </ | ||
+ | === Reloading Apache Configuration === | ||
+ | Once the vhost has been created you will need to reload apache for the configuration to take effect\\ | ||
+ | \\ | ||
+ | === IMPORTANT === | ||
+ | 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 | ||
+ | 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) | ||
- | Once the vhost has been created you will need to reload apache for the configuration to take effect:\\ | + | <sxh bash> |
- | CentOS/RHL 5,6: | + | <LocationMatch ^(.*/)\..*> |
- | <sxh bash>service httpd reload</sxh> | + | Order Allow, |
- | CentOS/RHL 7: | + | Deny from All |
- | <sxh bash>systemctl reload httpd</ | + | Satisfy All |
+ | </ | ||
+ | </ |
apache_vhost_centos.1427539582.txt.gz · Last modified: 2024/05/23 07:26 (external edit)