Nginx vs Apache

I recently added nginx as front end for apache. Now nginx serve static content, PHP requests are peroxided to Apache. Nginx frontend, Apache backend [root@server12 ~]# ab -n 1000 -c 100 http://netfree.netfreehost.com/ This is ApacheBench, Version 2.0.40-dev apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ Benchmarking netfree.netfreehost.com … Read more

Apache Limit access to a url

I want to limit access to admin login url of a web application to specified IP address. The web site had admin login in following URL https://domain.com/login To limit IP address, i edited Apache VirtualHost configuration for this web site, added Order deny,allow Deny from all Allow from 103.35.199.82 Allow from 51.38.246.115 Restart apache systemctl … Read more

Cpanel ReverseProxy Traffic to Docker Container

Apache mod_proxy

On a cpanel server, i need to run a web application using docker container. Application running side docker container listening on port 8000 on localhost. For a web site to serve traffic from this docker container, we can use Apache mod_proxy, this is enabled by default on cpanel servers. https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html You can verify it at … Read more

Apache Benchmark

ab is a tool for benchmarking web servers. It is designed to give you an impression of how your web server installation performs. This especially shows you how many requests per second your web server is capable of serving. http://httpd.apache.org/docs/2.4/programs/ab.html To benchmark a web site, use ab command provided by Apache. This will start 15000 … Read more

Apache AH00144: couldn’t grab the accept mutex

On Ubuntu 18.04 server, apache crashed. On checking apache error log, found following [Mon Aug 13 23:19:24.625927 2018] [mpm_prefork:emerg] [pid 2378] (43)Identifier removed: AH00144: couldn’t grab the accept mutex [Mon Aug 13 23:19:24.626990 2018] [mpm_prefork:emerg] [pid 1227] (43)Identifier removed: AH00144: couldn’t grab the accept mutex [Mon Aug 13 23:19:24.628515 2018] [mpm_prefork:emerg] [pid 1211] (43)Identifier removed: … Read more

Limit Access Using htaccess

To limit access to a folder using .htaccess, create .htacess file with following content. YOUR_IP_HERE = Replace it with your actual IP. You can white list IP range by entering CIDR notation for the IP range. Here is .htacess i use on one of my web sites admin folder. If your server is behind a … Read more

Run .html files as PHP in Apache

On Ubuntu, to execute .htm files as PHP, create file vi /etc/apache2/conf-enabled/php-html.conf Add following content SetHandler application/x-httpd-php This is similar code from your PHP configuration. In this case, it is from /etc/apache2/mods-available/php5.6.conf If you want it only for a specific website, edit VirtualHost entry for the website and add SetHandler application/x-httpd-php Example ServerName serverok.in ServerAlias … Read more

Apache SSL

Here is a non-SSL Apache virtual host. To convert it to SSL VirtualHost, first change the port to 443 Find Replace with Add the above Directory entry The resulting VirtualHost will look like For added security, you can use the following config Enable mod_ssl If you get the following error You need to enable mod_ssl, … Read more

Apache Invalid command Header

On a new Debian server with Apache, web site give 500 internal server error. On checking error log, i found [Thu Jan 04 06:44:42.483932 2018] [core:alert] [pid 27583] [client 112.133.248.19:63020] /home/user/public_html/.htaccess: Invalid command ‘Header’, perhaps misspelled or defined by a module not included in the server configuration The error is due to Apache headers module … Read more

htaccess

Limit Access Using htaccess Apache Limit access to a url Disable PHP on a folder How to protect .git folder using htaccess Password Protect Site using htaccess React Application showing 404 error on refresh Redirect Subdomain to Subdirectory How to Create Custom 404 Error Page in Apache CPanel SSL Renew on password protected site Magento … Read more

Apache Permission Denied

On a newly installed Apache server, when I visit the website, I get permission denied error. On Apache error log (/var/log/httpd/error_log), i found # tail -f /var/log/httpd/error_log [Sat Mar 29 16:29:22 2014] [error] [client 59.98.136.37] (13)Permission denied: access to /index.html denied [Sat Mar 29 16:29:25 2014] [error] [client 59.98.136.37] (13)Permission denied: access to /index.html denied … Read more