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/30 06:06] – 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> | ||
< | < | ||
- | 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\\ | ||
+ | |||
\\ | \\ | ||
- | === Restarting Apache | + | === IMPORTANT |
- | Once the vhost has been created you will need to reload | + | It is important |
- | CentOS/RHL 5,6: | + | \\ |
- | <sxh bash>service httpd reload</ | + | The httpd.conf or apache2.conf file comes with an entry preventing .htaccess and .htpasswd files being served: |
- | CentOS/RHL 7: | + | <sxh bash> |
- | <sxh bash>systemctl reload httpd</ | + | # 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.1427695579.txt.gz · Last modified: 2024/05/23 07:26 (external edit)