Archive for the ‘apache’ Category

Apache2 enable mod_proxy

a2enmod proxy_http

Change apache2 running user/group

vi /etc/apache2/envvars Edit export APACHE_RUN_USER=imran export APACHE_RUN_GROUP=www-data Save and restart apache

Web server production and prerelease environments

ln -s /var/www /var/www.prod   ln -s /var/www2 /var/www.prerelease

Apache enable SSL module

1. ls -ltr /etc/apache2/mods-enabled/ssl.load; ls -ltr /etc/apache2/mods-enabled/ssl.conf result: not found 2. sudo a2enmod ssl 3. ls -ltr /etc/apache2/mods-enabled/ssl.load; ls -ltr /etc/apache2/mods-enabled/ssl.conf result: created

Parking domain with htaccess

This setup excludes base url http://www.example.com from rewritting but any other url for example http://www.example.com/dis will be rewritten to http://www.example.net/dis RewriteEngine on RewriteCond %{REQUEST_URI} !^/$ RewriteCond %{HTTP_HOST} ^example.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.example.com [NC] RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]

Apache virtual hosting with aliases

For Debian/Ubuntu default installation no need to add NameVirtualHost directive. working configuration: ServerName yourdomain.com ServerAlias www.yourdomain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/path ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from none ErrorLog ${APACHE_LOG_DIR}/error-yourdomain.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel error CustomLog ${APACHE_LOG_DIR}/access-yourdomain.log combined