Warning: Undefined variable $html in /usr/share/nginx/html/lib/plugins/tabinclude/helper.php on line 240

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/nginx/html/lib/plugins/tabinclude/helper.php:240) in /usr/share/nginx/html/inc/Action/Export.php on line 106

Warning: Cannot modify header information - headers already sent by (output started at /usr/share/nginx/html/lib/plugins/tabinclude/helper.php:240) in /usr/share/nginx/html/inc/Action/Export.php on line 106
apache_vhost

Apache vhost

  • CentOS
  • Ubuntu

Vhosts (CentOS/RHEL)

Default configuration file: /etc/httpd/conf.d/
You will need to create a vhost in this directory, with the file ending in .conf.

For example:
/etc/httpd/conf.d/example.co.uk.conf

Example vhost for apache

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com
    DocumentRoot /var/www/vhosts/example.com/public_html

    <Directory /var/www/vhosts/example.com/public_html>
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/httpd/example.com-error_log
    CustomLog /var/log/httpd/example.com-access_log common
</VirtualHost>

Globally change website from example.com to your required domain:
:%s/example.com/newwebsite.com

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 '.' eg .hidden).
The httpd.conf or apache2.conf file comes with an entry preventing .htaccess and .htpasswd files being served:

# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</Files>

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)

<LocationMatch ^(.*/)\..*>
  Order Allow,Deny
  Deny from All
  Satisfy All
</LocationMatch>