Generic virtual host

From Wiki
Jump to: navigation, search
<VirtualHost *:80>
ServerName site23dfe.23.253.229.160.xip.io
ServerAlias www.site23dfe.23.253.229.160.xip.io
DocumentRoot /var/www/vhosts/site23dfe/htdocs
</VirtualHost>

<VirtualHost *:8801>
    ServerName site34508c.23.253.229.160.xip.io
    DocumentRoot /var/www/vhosts/site34508c/htdocs
</VirtualHost>

SSL redirect:

<VirtualHost *:80>
ServerName site3.104.130.78.113.xip.io
DocumentRoot /var/www/vhosts/site3/htdocs
CustomLog /var/www/vhosts/site3/logs/access.log combined
ErrorLog /var/www/vhosts/site3/logs/error.log
RewriteEngine on
RewriteCond %{SERVER_PORT} !443 [NC]
RewriteRule (.*) https://%{SERVER_NAME}/$1 [R,L,QSA]
</VirtualHost>

For SSL:

<VirtualHost *:443>
SSLEngine on
ServerName site3.104.130.78.113.xip.io
DocumentRoot /var/www/vhosts/site3/htdocs
CustomLog /var/www/vhosts/site3/logs/ssl_access.log combined
ErrorLog /var/www/vhosts/site3/logs/ssl_error.log
SSLCertificateFile /etc/pki/tls/certs/site3.104.130.78.113.xip.io.cert
SSLCertificateKeyFile /etc/pki/tls/private/site3.104.130.78.113.xip.io.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>

You can generate a self-signed cert at http://www.selfsignedcertificate.com/.