Apache Tomcat: Please increase maxThreads error and solution

last updated in Categories ,

Q. I am getting following error:

…All threads are busy, waiting. Please increase maxThreads or check the servlet status…
How do I fix this problem?

A. You need to setup a higher value for maxProcessors in Tomcat’s server.xml file. Open the file:

# vi server.xml

Set the maxProcessor value to 500 or something higher as per your requirement. Restart the Apache/Tomcat to take effect.

Apache Address already in use: make_sock: could not bind to port 80 or 443 error and solution

last updated in Categories , , , , , , ,

Q. How do I fix an error, while restarting Apache ~ Address already in use: make_sock: could not bind to port 80?

A. If you are running SELinux disable temporary for port 80.

Apache Address already in use: make_sock: could not bind to port 80 error and solution

First make sure port 80/443 is not used by any other service or application with netstat command:

# netstat -tulpn| grep :80

If port 80 is bind to httpd, kill all process:
# killall -9 httpd

Now start the httpd:
# /etc/init.d/httpd start

Also make sure you are root while starting the httpd.

Apache 403 Forbidden Error and Solution

last updated in Categories , , , , , , , , , , , ,

Q. I have successfully configured Apache web server for my client. But why does my clients website just say “Error 403 Forbidden”? For example when client send request http://myclient.com/something/ Apache generate a 403 error. How do I troubleshoot this problem?

Why my Apache Server Side Include (SSI) is not working?

last updated in Categories

Q. I would like to use Server Side Include (SSI) from my html pages. But it is not working for VirtualHost. How do I configure Apache Server Side Include?

A. From Aapache site, “SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology”.

Make sure you have following configuration directive/line in your .htaccess or httpd.conf file:

vi /etc/httpd/httpd.conf

OR

vi .htaccess

Add following directive:

Options +Includes

Above directive (Options +Includes) tells Apache that you want to permit files to be parsed for SSI directives.

Next, make sure Apache knows which files should be parsed using SSI.

AddType text/html .shtml
AddHandler server-parsed .shtml

Now test your configuration by adding any one of the following SSI directive:

$ vi test.shtml

Append any one of the following SSI directive:

<!–#echo var=”DATE_LOCAL” –>

OR

<!–include file=”counter.cgi”–>

Save the file. Restart Apache and test your configuration.

For more information see Apache SSI tutorial

Apache restrict access based on IP address to selected directories

last updated in Categories , ,

Apache web server allows server access based upon various conditions. For example you just want to restrict access to url http://payroll.nixcraft.in/ (mapped to /var/www/sub/payroll directory) from 192.168.1.0/24 network (within intranet).

Apache provides access control based on client hostname, IP address, or other characteristics of the client request using mod_access module.

Open your httpd.conf file:
# vi /etc/httpd/conf/httpd.confLocate directory section (for example/var/www/sub/payroll) and set it as follows:
<Directory /var/www/sub/payroll/>
Order allow,deny
Allow from 192.168.1.0/24
Allow from 127
</Directory>
Where,

  • Order allow,deny: The Order directive controls the default access state and the order in which Allow and Deny directives are evaluated. The (allow,deny) Allow directives are evaluated before the Deny directives. Access is denied by default. Any client which does not match an Allow directive or does match a Deny directive will be denied access to the server.
  • Allow from192.168.1.0/24: The Allow directive affects which hosts can access an area of the server (i.e. /var/www/sub/payroll/). Access is only allowed from network 192.168.1.0/24 and localhost (127.0.0.1).

Save file and restart apache web server:
# /etc/init.d/httpd restart

See also