Posts List

virtual-host configuration for Apache HTTP

Posting this literally so I don’t forget it. /etc/httpd/conf.d/vhosts.conf NameVirtualHost * include conf.d/vhosts.d/*.conf mkdir /etc/httpd/conf.d/vhosts.d /etc/httpd/conf.d/vhosts.conf NameVirtualHost * include conf.d/vhosts.d/*.conf /etc/httpd/conf.d/default.conf <VirtualHost _default_:*> ServerAdmin webmaster@localhost DocumentRoot /var/www/vhosts/default/html/ ServerName localhost <VirtualHost> /etc/httpd/conf.d/vhosts.d/www.example.com.conf <VirtualHost *:80> ServerName www.example.com ServerAdmin [email protected] DocumentRoot /var/www/vhosts/www.example.com/html RewriteEngine On RewriteCond %{ENV:REDIRECT_STATUS} !=503 RewriteRule .* - [R=503,L] ErrorDocument 503 /index.html Header always set Retry-After "60" <VirtualHost>

Apache HTTPD configuration to allow easy upgrading of OS

  mkdir /mnt/media/www/conf ln -s /mnt/media/www/conf /etc/httpd/conf.d/local /etc/httpd/conf.d/local.conf include conf.d/local/*.conf semanage fcontext -a -t httpd_sys_content_t "/mnt/media/www(/.*)?" semanage fcontext -a -t httpd_config_t "/mnt/media/www/conf(/.*)?" restorecon -Rv /mnt/media/www /mnt/media/www/conf/vhost_default.conf <VirtualHost _default_:*> ServerAdmin webmaster@localhost DocumentRoot /mnt/media/www/vhosts/default/html/ ErrorLog logs/default-error_log TransferLog logs/default-access_log <Directory "/mnt/media/www/vhosts"> AllowOverride None # Allow open access: Require all granted </Directory> <Directory "/mnt/media/www/vhosts/default/html"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> </VirtualHost>