Starting httpd: (99)Cannot assign requested address

On a server, when i restart apache, i got the error

The error was due to Apache trying to bind to an IP address, that is no longer present in the server. This is fixed by modifying /etc/httpd/conf/httpd.conf Replace

With

See Apache […]

Read More…

Apache Auto Renew SSL on Password Protected site

I have a web site that is password protected using Apache basic autenticiation. I used following code in Apache config to password protect.

The problem is when SSL need auto renew, it need url like http://domain/.well-known/ to be accessable with out any password for domain ownership verification. To allow .well-known folder to be accessable […]

Read More…

apachectl status www-browser not found

apachectl status

On a Ubuntu server, run i run apachectl status, i get following error.

To fix error, install lynx text based browser.

After installing lunx, apachectl status started working. See Apache […]

Read More…

Apache LogFormat show full domain name

To show full domain name in Apache access log, you can use following log format

If you want to show port also, use

[…]

Read More…

Redirect a folder to another

To redirect a folder to another using .htaccess, create

Or

Or

if new folder is on another domain, you can use https://new-domain.com/OLD_FOLDER See Redirect […]

Read More…

Password Protect Site using htaccess

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

Add following content

In this case, i used /etc/apache2/site-logins as AuthUserFile, this will store all user and password. You can change this file path to whatever you need. Make sure it is not accessable […]

Read More…

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 show actual visitor IP address, you need to install mod_cloudflare apache module. Before you can install the module, you need to install following requirments. On Debian/Ubuntu server,

Now install mod_cloudflare with

Restart apache […]

Read More…