apache directory index

Apache disable directory index

When Apache Directory Index is enabled, if you browse to a url that have no index file present, you will

Enable CORS in Apache

Enable CORS in Apache

To enable CORS in apache, add the following in VirtualHost or .htaccess Header always set Access-Control-Allow-Origin “*” Header always set

apachectl status

apachectl status www-browser not found

On a Ubuntu server, run i run apachectl status, i get following error. root@server:~# apachectl status /usr/sbin/apachectl: 113: /usr/sbin/apachectl: www-browser:

Apache LogFormat show full domain name

Apache LogFormat show full domain name

To show the full domain name in the Apache access log, you can use the following log format LogFormat “%h

Redirect a folder to another

Redirect a folder to another

To redirect a folder to another using .htaccess, create RedirectMatch 301 ^/OLD_FOLDER/(.*)$ /NEW_FOLDER/$1 Or RewriteEngine On RewriteRule ^OLD_FOLDER/(.*)$ /NEW_FOLDER/$1 [R=301,NC,L]

Password Protect Site using htaccess

Password Protect Site using htaccess

To password protect a web site or a sub folder using .htaccess, create a .htaccess file in the folder. vi

Apache Show Real IP Address when using CloudFlare

When using Apache web server behind cloudflare, apache logs show cloudflare IP address instead of real visitor IP address. To

Redirect site to HTTPS excluding a folder

Redirect site to HTTPS excluding a folder

On a web site, customer need to redirect all pages to HTTPS, but want to keep files in one of

Apache Performance Tuning

To optimize Apache web server, run curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | sudo perl

Apache Show Real IP Behind Reverse Proxy on CentOS

When Apache web server running behind reverse proxy or load balancer, server log and scripts show IP of reverse proxy

Apachectl

apachectl command is used to interact with Apache web server. To see Apache status apachectl status To list virtualhost info,

Apache run web site as user with mod_ruid2

Apache run web site as user with mod_ruid2

mod ruid2 allow you to run web site as differnt user from the one web server is running. This is